Focus next textview automatically

后端 未结 2 967
广开言路
广开言路 2021-01-02 14:39

I have a TextView with android:maxLength set to 3 and another with android:maxLength set to 7.

I wan

2条回答
  •  爱一瞬间的悲伤
    2021-01-02 15:13

    I haven't tried but this might work.

    Setup a listener to fire when the text was changed, for this use

    addTextChangedListener(TextWatcher watcher)
    

    Then based on the text length you can request the focus change to the next field.

    If you want to find out the next field you can call View.focusSearch(View.FOCUS_FORWARD) Find the nearest view in the specified direction that can take focus. This does not actually give focus to that view.

提交回复
热议问题