0

私のアプリケーションでは、次のようなレイアウトが必要です。

最初のレイアウト

ImageView、TableLayout、および Button を保持する Relative Layout でそれを行いました。問題は、キーボードを開いて EditText を変更すると、キーボードが EditText の上にあるため、ユーザーは自分が書いている内容を見ることができないことです。キーボードが表示されているときにレイアウトを次のようにしたい:

レイアウト 2

ユーザーは、イメージの一部のデータを EditText にコピーしたいので、EditText が表示されていなくても、キーボードが表示されている間、ビューを上にスクロールしてイメージ全体を表示できる必要があります。私はこのようにそれをやろうとしました:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="vertical" >

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/buttonEditStop"
    android:padding="10dip" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/stopImg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:clickable="true"
            android:contentDescription="@string/entry_img"
            android:onClick="ImageClick" />

        <TableLayout
            android:id="@+id/formLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/stopImg"
            android:layout_marginRight="10dp" >

           ...

        </TableLayout>
    </RelativeLayout>
</ScrollView>

<ImageButton
    android:id="@+id/buttonEditStop"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:contentDescription="@string/edit_stop"
    android:onClick="EditButtonClicked"
    android:src="@drawable/ic_menu_edit" />

このコードを使用すると、レイアウト全体が台無しになります。画像の上にフォームが表示され、続いて imageView に表示される画像を含む ImageButton が表示されます。

私が望むようなレイアウトを取得する方法を知っている人はいますか?

ありがとう!

4

1 に答える 1

2

EditText が重ならないようにするには、使用する必要がありました

android:windowSoftInputMode="adjustPan"

私のマニフェストで。

于 2013-02-15T11:30:30.253 に答える