Android:EditText NextFocusDown不会触发Spinner

在我的应用程序中,我有一个注册屏幕,有很多EditTexts和Spinners.
我想逐一浏览“注册”字段.

所以我应用了android:imeOptions =“actionNext”.但它忽略了所有的Spinners.它将仅关注EditText.我也试过setNextFocusDownId().这也忽略了纺纱厂.

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/reportentry11"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/numbers"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"

            android:imeOptions="actionNext"
            android:inputType="phone" 
            >
           <requestFocus/>
        </EditText>

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/reportentry12"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            >

            <TextView
                android:id="@+id/txt_exp"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                android:text="EXP:"
                android:textColor="#000000"
                android:textSize="12dp" />

            <Spinner
                android:id="@+id/spin_date"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="3"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:nextFocusDown="@+id/spin_year"
                android:text="date"
                android:textSize="12dp" />

            <Spinner
                android:id="@+id/spin_year"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginRight="5dp"

                  android:nextFocusDown="@+id/cvc"
                android:text="year"
                android:textSize="12dp" />
        </LinearLayout>

        <EditText
            android:id="@+id/cvc"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:hint="@string/reg_label_cvc"
            android:imeOptions="actionNext"
            android:inputType="phone" />

        <EditText
            android:id="@+id/fname"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/reg_label_fname"
            android:imeOptions="actionNext" />

        <EditText
            android:id="@+id/address"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/reg_label_address"
            android:imeOptions="actionNext" />

        <EditText
            android:id="@+id/city"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="@string/reg_label_city"
            android:imeOptions="actionNext"
            android:nextFocusDown="@+id/pr_spin" />

        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/reportentry13"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/txt_pr"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="PROV:"
                android:textColor="#000000"
                android:textSize="12dp" />

            <Spinner
                android:id="@+id/pr_spin"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="date"
                android:imeOptions="actionNext"
                android:textSize="14dp" />

            <EditText
                android:id="@+id/pcode"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:hint="@string/reg_label_pcode"
                android:imeOptions="actionDone" />
        </LinearLayout>

        <Button
            android:id="@+id/register_register_button"
            android:layout_width="wrap_content"
            android:background="@drawable/green_button_bg"
            android:onClick="completeClicked"
            android:text="@string/reg_label_complete"
            android:textSize="28dp"
            android:textStyle="bold" />
    </LinearLayout>

请为我提供触发纺纱厂的最佳方法.

解决方法

在你的编辑文本上,覆盖onEditorAction并给予焦点(或做任何事情,比如打开你的微调器)……
yourEditTXT.setonEditorActionListener(new OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView view,int actionID,KeyEvent event) {
            if (actionID == EditorInfo.IME_ACTION_NEXT) {
                //do your stuff here...
                return true;
            }
            return false; 
    }
});

编辑12/4:
我发现你昨晚仍然在努力解决这个问题,如果你没有找到解决方案(并且没有发布一个解决方案)或帮助其他人阅读本文,这可能有助于从微调器中编辑文本.

mySpinner.setonItemSelectedListener(new MyOnItemSelectedListener());            

public class MyOnItemSelectedListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parentview,View v,int position,long id) {
            // your spinner proces code 
            // then when you are done,yourEditText.setFocusableInTouchMode(true);  //if this is not already set
            yourEditText.requestFocus();  //to move the cursor
            final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            inputMethodManager.showSoftInput(yourEditText,InputMethodManager.SHOW_IMPLICIT);  // this line and the one above will open the soft keyboard if it doesn't already open
        }

        public void onnothingSelected(AdapterView<?> arg0) { }
    };

相关文章

这篇“android轻量级无侵入式管理数据库自动升级组件怎么实现...
今天小编给大家分享一下Android实现自定义圆形进度条的常用方...
这篇文章主要讲解了“Android如何解决字符对齐问题”,文中的...
这篇文章主要介绍“Android岛屿数量算法怎么使用”的相关知识...
本篇内容主要讲解“Android如何开发MQTT协议的模型及通信”,...
本文小编为大家详细介绍“Android数据压缩的方法是什么”,内...