WindowSoftInputMode and ScrollView

The main action of my Android application is as follows:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/ScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:orientation="vertical"
        android:paddingLeft="60dp"
        android:paddingTop="53dp" >

        <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/RelativeLayout1"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/billAmountText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/billAmount_string"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <EditText
                android:id="@+id/billAmount"
                android:layout_width="173dp"
                android:layout_height="wrap_content"
                android:layout_below="@id/billAmountText"
                android:layout_marginTop="3dp"
                android:inputType="numberDecimal" />
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>

To make sure that the background image (defined in the first RelativeLayout) is not compressed when the keyboard pops up, I set the android:windowSoftInputMode="stateVisible|adjustPanmanifest file for my activity. Now everything is fine with the background and layout, nothing changes.

But the problem is that my ScrollView is not working now, because I believe that the system thinks that the window does not need to be resized due to my manifest modification above - therefore ScrollView is not activated. The opposite happens when I take it out android:windowSoftInputMode="stateVisible|adjustPan, scrolling works, but the background shrinks when the keyboard pops up.

Is there a way to encode it so that my background does not shrink and my ScrollView is still working? Thank!

+5
2

windowSoftInputMode :

android:windowSoftInputMode="stateAlwaysHidden|adjustResize"

, , ScrollView fillViewPort true. , :

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true">

        <!-- Other Views -->
</ScrollView>

.

+3

scrollview , 0 - , child 1 - . (src), . scaleTypes, .

0

All Articles