1

画面に3つの編集テキストがあります。エディットテキストに触れる前の小さな画面のデバイスでは、私の画面は次のようになります

ここに画像の説明を入力してください

そして、最初のエディットテキスト(名前の前など)をタッチすると、キーボードのポップアップが表示され、

ここに画像の説明を入力してください

つまり、edittext Amount(Amountという名前のTextViewの前にあります)がユーザーの前にあります。しかし、最初に(名前)編集テキストをタッチ(またはクリック)したので、ユーザーの前に表示したいと思います。しかし、金額が前にあるたびにどちらを選択しても。

requestFocus()とsetSelect(true)を使用してみました。フォーカスが真に戻ることさえありますが、何も機能しません。

それで、それをどのように行うのですか?

これらの3つの編集テキストとその前にある3つのテキストボックスを含むテーブルレイアウトにスクロールビューを与えました。

私のxmlコードは

<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="match_parent"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/rl_upload_header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center"
    android:minHeight="50dp" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/selected_image_detail"
        android:textSize="20sp"
        android:textStyle="bold" />
</LinearLayout>

<LinearLayout
    android:id="@+id/rl_upload_top"
    android:layout_width="fill_parent"
    android:layout_height="150dp"
    android:layout_weight="4"
    android:baselineAligned="false"
    android:gravity="center"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:contentDescription="@string/empty" >
    </ImageView>
</LinearLayout>

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight="2"
    android:gravity="center" >

    <TableLayout
        android:id="@+id/tableLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="5dip" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/name_table" />

            <EditText
                android:id="@+id/ed_img_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:background="@drawable/text_box_background"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:hint="@string/name"
                android:paddingLeft="5dip" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="5dip" >

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/amount_table" />

            <EditText
                android:id="@+id/ed_amount"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:background="@drawable/text_box_background"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:hint="@string/amount"
                android:paddingLeft="5dip" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:padding="5dip" >

            <TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/desc_table" />

            <EditText
                android:id="@+id/ed_desc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:background="@drawable/text_box_background"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:hint="@string/desc"
                android:paddingLeft="5dip" />
        </TableRow>
    </TableLayout>
</ScrollView>

<LinearLayout
    android:id="@+id/rl_upload_bottom"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:baselineAligned="false"
    android:gravity="center"
    android:minHeight="70dp" >

    <Button
        android:id="@+id/button_update"
        android:layout_width="150dp"
        android:layout_height="40dp"
        android:background="@drawable/btn_update" >
    </Button>
</LinearLayout>

4

1 に答える 1

3

関連するアクティビティを明示するために、以下の行を追加します。

android:windowSoftInputMode="adjustPan"
于 2013-01-08T10:07:32.697 に答える