从EditText导航到Spinner

时间:2016-01-31 19:37:49

标签: android android-edittext spinner

我有一个注册表单,在几个EditText字段之间,我有一个Spinner。以下是布局的外观:

enter image description here

字段High School Graduation YearSpinner(必须使其看起来像EditText)。因此,当我在字段Password并单击导航到下一个软键时,焦点将转到字段Zip Code。我希望焦点转到High School Graduation Year,以便下拉列表打开。我尝试添加这个:

android:nextFocusDown="@+id/graduationYear"

到我的密码布局,但它没有锻炼。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:1)

即使我不久就遇到了类似的问题。我在EditText上添加了mPasswordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT) { mPasswordEditText.clearFocus(); mHighSchoolSpinner.requestFocus(); mHighSchoolSpinner.performClick(); } return true; } }); ,如下所示,并且有效。

MyForm.bindFromRequest.fold( // ...