2017-10-06 27 views
0

当创建包含两个editText小部件的简单recyclerView时,输入数据时下一个焦点元素的方向与pic1类似---如何设置pic2上下一个焦点元素的方向? 欢呼recycle查看下一个焦点方向

pic1

pic2

我简单的代码

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

    <EditText 
     android:id="@+id/edit_text_left" 
     tools:hint="editTextLeft" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" /> 

    <EditText   
     android:id="@+id/edit_text_right" 
     tools:hint="editTextRight" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" /> 

</LinearLayout> 

回答

1

尝试这种使用android:imeOptions="actionNext"将焦点移动到下一个Editext

<EditText 
    android:id="@+id/edit_text_left" 
    tools:hint="editTextLeft" 
    android:layout_width="0dp" 
    android:layout_weight="1" 
    android:inputType="text" 
    android:imeOptions="actionNext" 
    android:layout_height="wrap_content" /> 

让你拉yout like this

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

    <EditText 
     android:id="@+id/edit_text_left" 
     tools:hint="editTextLeft" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:inputType="text" 
     android:imeOptions="actionNext" 
     android:layout_height="wrap_content" /> 

    <EditText   
     android:id="@+id/edit_text_right" 
     tools:hint="editTextRight" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:inputType="text" 
     android:imeOptions="actionNext" 
     android:layout_height="wrap_content" /> 

</LinearLayout>