5

ヘッダーとフッターを含むフラグメントが必要です。(もちろん)その間にあるコンテンツはスクロール可能である必要があります。そこまでは順調です。しかし、スクロールビューの内部は編集テキストである必要があるため、特定の瞬間にキーボードが表示されます。残念ながら、キーボードでもフッターが表示されるか、windowSoftInputMode をadjustPanに変更するとヘッダーが非表示になります。

要するに、私が達成したいのは、フッターが一番下にとどまるが、スクロールビューの内容が上にスクロールすることです(キーボードが編集テキストにフォーカスを移したとき)。また、ヘッダーは常に表示されている必要があります。

この動作を達成する方法について何か提案はありますか?

4

2 に答える 2

0

android:isScrollContainer="false" を試しましたか?

于 2012-03-20T10:46:43.993 に答える
0

Android ヘッダー フッターとスクロール可能なコンテンツ (本文)

次のことを試すことができます。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:padding="10dp" >

        <TextView
            android:id="@+id/TextView01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="header"
            android:textSize="40sp" >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/footer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:padding="10dp" >

        <TextView
            android:id="@+id/TextView02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="footer"
            android:textSize="40sp" >
        </TextView>
    </LinearLayout>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/footer"
        android:layout_below="@id/header" >

        <LinearLayout
            android:id="@+id/body"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/edit1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit4"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit5"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit6"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit7"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <EditText
                android:id="@+id/edit8"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="10dp" />

            <Button
                android:id="@+id/btn"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Submit" />
        </LinearLayout>
    </ScrollView>

</RelativeLayout>

android:windowSoftInputMode="adjustPan"Android マニフェストのアクティビティに追加します。

于 2013-01-23T11:38:45.937 に答える