Reputation: 1779
I've added 7+ TextInpuLayout with parent ScrollView and TextInputLayout hides after showing only first one for some devices and for some devices it's working very good. here is two screenshots for better understanding
but hides automatically like this
i'm using implementation 'com.android.support:design:26.1.0'
for design library.
and here is the layout file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbars="vertical"
tools:context="clockworktt.gaby.com.GuestProfileActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/guest_profile_toolbar"
layout="@layout/app_bar_layout"></include>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
android:gravity="center"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/guest_profile_image"
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ic_avatar" />
<TextView
android:id="@+id/guest_profile_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Guest Name"
android:textAlignment="center"
android:textColor="@color/almostWhite"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="210dp"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_name_input_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Name"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_salutation_input_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Salutation"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_occupation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
>
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Occupation"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_company"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Company"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone"
android:inputType="numberDecimal"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_expected_numbers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Expected Numbers"
android:inputType="phone"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/profile_notes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:hint="Notes"
android:inputType="textShortMessage"
android:maxLines="3"
android:paddingLeft="10dp"
android:textColor="@color/colorPrimaryDark"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/profile_update_button"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:text="Update"
android:background="@color/colorAccent"
android:textAllCaps="false"
android:textColor="@color/almostWhite"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
please someone help.Thanks
Upvotes: 1
Views: 39
Reputation: 755
Try to set layout_height attribute of TextInputLayout to wrap_content.
Upvotes: 1