I have a <ScrollView>
layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/input_one"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<EditText
android:id="@+id/input_two"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<EditText
android:id="@+id/input_three"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" >
<Button
android:id="@+id/ok_btn"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="@string/ok_str" />
</LinearLayout>
</ScrollView>
As you see above, the simple layout consists of three input fields and an "Ok" button.
I run my app with the above layout, when I tap on the 1st input field (@+id/input_one
), the soft keyboard will pop up from the bottom of the screen, it hides the 3rd input field and the "Ok" button.
Since I use <ScrollView>
, I thought I can scroll the page up in order to see the 3rd input field and "Ok" button which are hidden by the soft keyboard, but the page is not scrollable. Why? How to get rid of it? basically, i would like to see every input fields and "Ok" button even the soft keyboard popped up.
I fixed the problem by defining the following attribute in <activity>
of AndroidManifest.xml
android:windowSoftInputMode="adjustResize"