I am trying to the softkeyboard so the user can enter his information to create a new account on my android app. The problem is that some of my TextEdits are always flowing outside the screen and the user can not see what he actually typed. The screen looks this way:

This screen was built using the following xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent">
<com.markupartist.android.widget.ActionBar
android:id="@+id/actionbar"
style="@style/ActionBar"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0">
<LinearLayout
android:layout_gravity="bottom"
android:paddingTop="15dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText android:id="@+id/txtPhoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:nextFocusUp="@+id/LoginButton"
android:nextFocusDown="@+id/txtPassword"
android:hint="Phone Number"
android:inputType="number"
android:singleLine="true" />
<EditText android:id="@+id/txtPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:hint="Password"
android:inputType="textPassword"
android:singleLine="true"
android:nextFocusDown="@+id/txtName"/>
<EditText android:id="@+id/txtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:hint="Name"
android:singleLine="true"
android:nextFocusDown="@+id/txtPin" />
<EditText android:id="@+id/txtPin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:hint="Pin"
android:inputType="number"
android:singleLine="true" />
</LinearLayout>
</ScrollView>
<LinearLayout android:id="@+id/buttonsLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip" >
<Button android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="@string/btnLogin"
android:onClick="onRegisterClick" />
</LinearLayout>
And in my AndroidManifest.xml I have defined my Activity this way:
<activity android:name=".activity.NewAccountActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
I have tried my different combinations of layout and windowSoftInputMode, but i never can get the TextEdit that is being changed to be visible on the screen. Am I missing anything here?
Thanks for any reply
T
You can use
adjustPanto keep the field inside the visible area on the screen:Update:
Try not using
Viewoutside ofScrollView. I’ve changed your layout to have one top-levelScrollViewand innerLinearLayout. All other elements are located insideLinearLayout. That’s because Android does not know how to scrollScrollViewcorrectly when adjusting the screen for soft keyboard.