林下一個按鈕,並在相同的屏幕有一個更EditText
當我按下進入鍵盤按鍵,焦點不會得到改變。機器人:使用</p> <pre><code>android:digits="abcdefghijklmnopqrstuvwxyz. " </code></pre> <p>位數不允許在鍵盤
想如果我刪除
android:digits
回車鍵工作正常,並移動到下一個編輯文本。
林下一個按鈕,並在相同的屏幕有一個更EditText
當我按下進入鍵盤按鍵,焦點不會得到改變。機器人:使用</p> <pre><code>android:digits="abcdefghijklmnopqrstuvwxyz. " </code></pre> <p>位數不允許在鍵盤
想如果我刪除
android:digits
回車鍵工作正常,並移動到下一個編輯文本。
在你的EditText添加android:imeOptions="actionNext"
在XML
<EditText
android:id="@+id/et_count"
android:layout_width="100dp"
android:singleLine="true"
android:imeOptions="actionNext"
android:layout_height="wrap_content" />
您可以使用imeOptions
的xml
爲EditText
屬性可用。
請嘗試以下操作。它在我的情況下工作。
在XML:
<EditText
android:id="@+id/edit_text1"
android:layout_width="match_parent"
android:layout_height="45dp"
android:digits="abcdefghijklmnopqrstuvwxyz. "
android:imeOptions="actionNext"/>
<EditText
android:id="@+id/edit_text2"
android:layout_width="match_parent"
android:layout_height="45dp"/>
然後,在JAVA:
EditText edit_text1 = (EditText) findViewById (R.id.edit_text1);
EditText edit_text2 = (EditText) findViewById (R.id.edit_text2);
edit_text1.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_NEXT) {
edit_text2.requestFocus();
handled = true;
}
return handled;
}
});
由於做工精細 –
不在這裏工作。當數字屬性存在時,imeOptions不起作用。這是爲什麼 ? –
@BugsHappen對於修復嘗試添加android:singleLine =「true」,從http://stackoverflow.com/questions/11048007/using-androiddigits-attribute-to-restrict-characters-stops-action-next-button- w –