当编辑文本有焦点或在android中被选中时,如何将其置于前面

当编辑文本有焦点或在android中被选中时,如何将其置于前面,android,select,focus,android-edittext,android-softkeyboard,Android,Select,Focus,Android Edittext,Android Softkeyboard,我在屏幕上有3个编辑文本。在触摸编辑文本之前,在小屏幕设备上,我的屏幕看起来像 触摸first edittext(如姓名前)后,键盘弹出窗口出现,看起来 i、 e.现在edittext金额(位于TextView命名金额前面)现在位于用户前面。但当我触摸(或单击)第一个(名称)edittext时,我希望它出现在用户面前。但无论我选择哪一个,每次金额都在前面 我尝试过使用requestFocus()和setSelect(true)。即使focus返回true,但都不起作用 那怎么做呢 我已经给出

我在屏幕上有3个编辑文本。在触摸编辑文本之前,在小屏幕设备上,我的屏幕看起来像

触摸first edittext(如姓名前)后,键盘弹出窗口出现,看起来

i、 e.现在edittext金额(位于TextView命名金额前面)现在位于用户前面。但当我触摸(或单击)第一个(名称)edittext时,我希望它出现在用户面前。但无论我选择哪一个,每次金额都在前面

我尝试过使用requestFocus()和setSelect(true)。即使focus返回true,但都不起作用

那怎么做呢

我已经给出了tablelayout的滚动视图,其中包含这三个EditText和前面的三个文本框

我的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>


在相关活动的清单中添加以下行

android:windowSoftInputMode="adjustPan"