4

テキスト、いくつかの EditTexts およびいくつかのボタンを表示するために、内部に TableLayout を含む LinearLayout を持つ画面で作業しています。

問題は、スマートフォンで、レイアウトの上部にある EditText をクリックすると、下部にあるボタンがソフト キーボードの後ろに隠れてしまうことです。ボタンを再度表示する唯一の方法は、ソフト キーボードを非表示にすることです。

ここに画像の説明を入力

ソフト キーボードの上にレイアウトを作成してビューのボタンまでスクロールすることは可能ですか? ユーザーはソフト キーボードとボタンの下部を見ることができますか?

TableLayout の周りで ScrollView を使用しようとしましたが、レイアウトのボタンまでスクロールしないため、ユーザーは下まで見ることができません。

これは私のレイアウトです:

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

        <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
                <LinearLayout
                    android:id="@+id/linearLayoutMain"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:orientation="vertical" >

                    <include layout="@layout/login_container"/>

                    <LinearLayout 
                         android:orientation="horizontal"
                         android:background="@drawable/_grey_rounded_bottom"
                         android:layout_width="match_parent"
                         android:layout_height="30dp"/>

                </LinearLayout> 
        </ScrollView>  
</LinearLayout>

前もって感謝します。

4

3 に答える 3

0

android:windowSoftInputMode="stateVisible|adjustPan"マニフェストのアクティビティタグに追加すると、うまくいくはずです。

于 2013-07-25T03:48:39.923 に答える
0
  1. android:windowSoftInputMode="adjustResize" を試してください
  2. scrollView に兄弟ビュー要素がある場合は、ScrollView でこれを試してください

    Android:layout_width="match_parent" Android:layout_height="0dp" Android:layout_weight="1"

于 2014-08-12T12:01:57.017 に答える
0

私も同様の見解を持っており、それは私のために実行されます。私のコードを見てください:

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

    <LinearLayout ... /> <!--Have an image that I want to stay on the top -->

    <ScrollView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" ... >

        <RelativeLayout ... >
            <!-- EditText of username and EditText of password and a CheckBox -->
            <LinearLayout 
                android:id="@+id/linearLayoutEntrar"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/checkBoxRecordarDatos"
                android:gravity="center"
                android:layout_marginTop="7dp"
                android:weightSum="1.0">

                <Button
                    android:id="@+id/buttonEntrar"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.5"
                    android:text="@string/login_entrar"
                    android:textColor="@android:color/white"
                    android:textStyle="bold"
                    android:textSize="@dimen/textSize"
                    android:onClick="entrar" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayoutJugar"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/linearLayoutEntrar"
                android:layout_marginTop="7dp"
                android:gravity="center"
                android:weightSum="1.0" >

                <Button
                    android:id="@+id/buttonJugar"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.5"
                    android:onClick="jugar"
                    android:text="@string/login_jugar"
                    android:textColor="@android:color/white"
                    android:textSize="@dimen/textSize"
                    android:textStyle="bold" />

            </LinearLayout>
        </RelativeLayout>
    </ScrollView>
</LinearLayout>

レイアウトごとに高さを変えてみてください。成功しない場合、問題はTableLayout、私のように使用しないことだと思います。

于 2013-07-10T10:56:32.280 に答える