14

レイアウトは次のとおりです。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1" />

        <FrameLayout
            android:background="#0000ff"
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1" />

    </LinearLayout>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" />

</RelativeLayout>

ここに画像の説明を入力

EditText がタッチされ、ソフト キーボードが表示されたときに、青いバーがそのまま残るようにします。つまり、そのサイズと位置を保持したいのです。android:windowSoftInputModeAndroidManifest で、アクティビティのパラメーターの 4 つの可能な値すべてを試しました。そして、ソフトキーボードが表示されると、常に青いバーが移動または縮小します。

android:windowSoftInputMode="adjustUnspecified"またはデフォルトで:

ここに画像の説明を入力

android:windowSoftInputMode="adjustPan"またはandroid:windowSoftInputMode="adjustNothing":

ここに画像の説明を入力

android:windowSoftInputMode="adjustResize":

ここに画像の説明を入力

ソフト キー b が表示されたときに、同じサイズと位置を維持することはできますか?

4

3 に答える 3

1

入力はEditTextあなたのものに入るので、常に何かを動かします。

2 つのレイアウトを用意することを検討してください。1 つはキーボードが下にあるとき用で、もう 1 つはキーボードが上にあるとき用です。

a を使用するViewSwitcherと、これに役立つ場合があります。

于 2012-10-30T10:32:14.637 に答える