android - Move to next edittext in Pin screen -


I know the question has been asked many times, but none of their solutions can work for me That's something I'm making a mistake. I want to transfer the next one to the next EditText . It has a pin screen with four edits, I hope if we can do some code by putting the layout in XML.

Here is a part of my code - `

  & lt; EditText android: id = "@ + id / nUM2" Android: layout_width = "30dp" Android: layout_height = "30dp" Android: layout_marginRight = "7dp" android: background = "@ drawable / framework" Android: inputType = "numberPassword" Android: maxLength = "1" Android: maxLines = "1" Android: imeOptions = "Action Next" Android: singleLine = "true" /> & Lt ;! - Android: nextFocusForward = "@ + id / num3" - & gt; & Lt; EditText android: id = "@ + id / num3" Android: layout_width = "30dp" Android: layout_height = "30dp" Android: layout_marginRight = "7dp" android: background = "@ drawable / framework" Android: inputType = "number password "Android: Maxilabil =" 1 "Android: Maxline =" 1 "Android: singleLine =" true "/> & Lt ;! - Android: nextFocusForward = "@ + id / num4" - & gt; & Lt; EditText android: id = "@ + id / num4" Android: layout_width = "30dp" Android: layout_height = "30dp" Android: layout_marginRight = "7dp" android: background = "@ drawable / framework" Android: imeActionId = "@ + id / presents "Android: imeActionLabel =" Log in "Android: imeOptions =" ​​actionDone "Android: inputType =" numberPassword "android: maxLength =" 1 "Android: Maxlines =" 1 "Android: singleLine =" true "/ & Gt; & Lt ;! - Android: nextFocusForward = "@ + id / submit" - & gt;   

`

The key you pressed for the first edit text And if this was the "Enter" key, then the next editText focus.

  et1.setOnKeyListener (New OnKeyListener () {public boolean OnKey (see V, int keycode, KeyEvent event) {if (keycode == 66) {et2.requestFocus ();} return false ;}});   

Or you can do this also through the text viewer, with it you can achieve it using the Text Woucher class and then focus on the next editing text, Whose OnTextChanged () method contains TextWatcher

  et1.addTextChangedListener (New TextWatcher () {public void onTextChanged (CharSequence s, int start, before int, int count) {// TODO Auto-generated method stub if (et1. According to your requirement {et2.requestFocus ();}} Text before public zero (changing width, integer number, integer number, integer) {// to two auto-generated melt stub} Text after the public zero (editable) { // TODO auto generated method stub}});    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -