Problema no próximo button do keyboard Android no EditText

Estou enfrentando um problema que eu tenho campos de nome de user e senha na atividade, agora quando eu clicair no keyboard de nome de user apairece, mas nenhum button a seguir e não posso passair paira o próximo controle do Edittext através do keyboard, neste caso, o keyboard exibe o button Enter, como anexado na captura de canvas que aumenta sua altura,

Qualquer um me guia qual é a solução paira este problema (paira exibir o próximo button no edittext)?

Qualquer ajuda seria apreciada insira a descrição da imagem aqui

Meu código

txtUserid = (EditText)findViewById(R.id.txtUserID); txtUserPasword = (EditText)findViewById(R.id.txtPassword); txtUserid.setNextFocusDownId(R.id.txtPassword); txtUserPasword.setNextFocusDownId(R.id.btnLogin); 

9 Solutions collect form web for “Problema no próximo button do keyboard Android no EditText”

Adicione estas linhas abaixo das suas linhas de código que você forneceu:

 txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); public boolean onKey (Ver v, int keyCode, evento KeyEvent) { txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); { txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); retornair viewdadeiro; txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); } txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); retornair falso; txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); } txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); }); txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); public boolean onKey (Ver v, int keyCode, evento KeyEvent) { txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); { txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); retornair viewdadeiro; txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); } txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); retornair falso; txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); } txtUserid.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press txtUserid.cleairFocus(); txtUserPasword.requestFocus(); return true; } return false; } }); txtUserPasword.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on Enter key press // check for username - password correctness here return true; } return false; } }); 

Adicione android:singleLine="true" android:nextFocusDown="@+id/textView2" no seu xml. Mostrairá a próxima tecla e também se concentrairá no próximo campo.

No seu layout, basta definir os attributes XML android:imeOptions="actionNext" paira suas primeiras três checkboxs de text e android:imeOptions="actionDone" paira o último.

Mais exemplos

Se o seu EditText é suposto ter apenas 1 linha, adicione o atributo android:singleLine="true" no seu XML, que irá remoview a tecla Enter e substituí-lo pelo button Next / Done .

use este atributo:

 android:inputType="textPersonName" 

Basta adicionair android: singleLine = "true" paira a tag EditText no layout XML ..

Apenas adicione android: singleLine = "true" você não precisa desse código paira isso

Outra melhor solução seria:

 android:singleLine="true" android:imeOptions="next" 

Adicione seu layout xml

em supor que você quer 4 edittext em linha, então primeiro três editext você estabeleceu abaixo,

 android:imeOptions="actionNext" 

e o último editext que você configurou

 android:imeOptions="actionDone" 

adicione linha paira adicionair, use

  android:singleLine="true" 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.