Reputation: 1776
The soft keyboard covers up my EditText
fields when attempting to type into the EditText
.
How can i prevent the soft keyboard from covering up my EditText
fields?
After pressing the back button i can see what i typed, because the soft keyboard is no longer covering the EditText
.
I am using the galaxy 10.1 inch tablet.
XML
<ScrollView
android:layout_width="wrap_content"
android:layout_height="400dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="1) Project"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/projectET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:textSize="25sp"
android:ems="10"
android:hint="Project"
android:inputType="textCapWords"
android:layout_gravity="bottom"/>
<CheckBox
android:id="@+id/projectCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="2) Customer"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/customerET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textCapWords"
android:layout_gravity="bottom"
android:textSize="25sp"
android:hint="Customer" />
<CheckBox
android:id="@+id/customerCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/material1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="3) Material"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:id="@+id/materialET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:textSize="25sp"
android:layout_gravity="bottom"
android:inputType="textCapWords"
android:ems="10"
android:hint="Material" />
<CheckBox
android:id="@+id/materialCBM"
android:layout_width="wrap_content"
android:layout_height="55dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="4) Phase"
android:layout_gravity="bottom"
android:textColor="#000000"
android:textSize="25sp" />
<EditText
android:id="@+id/fazeET"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="Phase" />
<CheckBox
android:id="@+id/fazeCBM"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="5)"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="55dp"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="6)"
android:layout_gravity="bottom"
android:textColor="#000000"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="55dp"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="7)"
android:layout_gravity="bottom"
android:textColor="#000000"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="55dp"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="8)"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="55dp"
android:layout_height="wrap_content"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="9)"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="55dp"
android:layout_height="wrap_content"
android:enabled="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="10)"
android:textColor="#000000"
android:layout_gravity="bottom"
android:textSize="25sp" />
<EditText
android:layout_width="500dp"
android:layout_height="wrap_content"
android:ems="10"
android:layout_gravity="bottom"
android:textSize="25sp"
android:enabled="false"
android:hint="" />
<CheckBox
android:layout_width="55dp"
android:layout_height="wrap_content"
android:enabled="false" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Upvotes: 1
Views: 3069
Reputation: 34594
You need to use the windowSoftInputMode. This will allow your UI to resize when the keyboard comes up. Allowing the user to see the EditText
while typing in the keyboard.
Add this attribute in your AndroidManifest.xml to your Activity
.
android:windowSoftInputMode="adjustPan"
Upvotes: 5
Reputation: 1857
Well, I think you have some fixed layout above your ScrollView
, because usually the ScrollView
would automatically scroll to the Focused component.
So, if I am right, there is two options (that I know):
ScrollView
over the keyboard orScrollView
to an upper
and visible position, after ScrollView
is visible it will
automatically show the right EditText
to the user.Upvotes: 0