Android 自动在各种视图中移动

Android 自动在各种视图中移动,android,android-layout,android-view,Android,Android Layout,Android View,我使用两个AutoCompleteTextView,后面是两个EditText视图,它们实现了datePickerDialog、一个复选框和一个按钮。我的目标是动态地从一个视图移动到另一个视图,这样当我单击其中一个自动完成或选择日期时,它就会移动到下一个视图 我使用focusable从第一个AutoCompleteTextView移动到另一个,但它似乎有点无用,因为我首先必须选择一个AutoComplete,然后才按enter键。有没有办法从这样的角度进行更动态的转换 此外,如果我使用dateP

我使用两个AutoCompleteTextView,后面是两个EditText视图,它们实现了datePickerDialog、一个复选框和一个按钮。我的目标是动态地从一个视图移动到另一个视图,这样当我单击其中一个自动完成或选择日期时,它就会移动到下一个视图

我使用focusable从第一个AutoCompleteTextView移动到另一个,但它似乎有点无用,因为我首先必须选择一个AutoComplete,然后才按enter键。有没有办法从这样的角度进行更动态的转换

此外,如果我使用datePickerDialog在视图上添加焦点,日历将停止工作。因此,流在第二个AutoCompleteTextView处停止,并清楚地高亮显示它。有什么建议可以让这个过程尽可能动态

以下是我的xml,以便更好地理解:

<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"
    android:background="#0099cc">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <AutoCompleteTextView
        android:id="@+id/location_from"
        android:inputType="text"
        android:hint="@string/departure_loc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:imeOptions="actionNext"
        android:clickable="true"/>

    <AutoCompleteTextView
        android:id="@+id/location_to"
        android:inputType="text"
        android:hint="@string/holiday_loc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:imeOptions="actionNext"
        android:clickable="true"/>


    <EditText
        android:id="@+id/departure_date"
        android:inputType="date"
        android:hint="@string/dep_date"
        android:clickable="true"
        android:focusable="false"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp" />


    <EditText
        android:id="@+id/return_date"
        android:inputType="date"
        android:hint="@string/return_date"
        android:clickable="true"
        android:focusable="false"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp" />

    <CheckBox
        android:id="@+id/direct_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:text="@string/direct_only"/>


</LinearLayout>


<Button
    android:id="@+id/search_button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/search_button"
    android:background="@color/colorPrimary"
    android:layout_alignParentBottom="true" />


请阅读以下内容:按enter键时,“nextFocusXXX”应跳转到下一个视图感谢@Itzik的回答,但我的问题是我无法使EditText视图聚焦,因此流在那里受阻。我尝试了nextFocusForward或nextFocusDown,但它在EditText中的datePickerDialog之前停止