How to set cursor position in EditText?

前端 未结 23 1500
广开言路
广开言路 2020-11-28 02:51

There are two EditText,while loading the page a text is set in the first EditText, So now cursor will be in the starting place of EditText, I want

23条回答
  •  感情败类
    2020-11-28 03:14

    as a reminder: if you are using edittext.setSelection() to set the cursor, and it is NOT working while setting up an alertdialog for example, make sure to set the selection() AFTER the dialog has been created

    example:

    AlertDialog dialog = builder.show();
    input.setSelection(x,y);
    

提交回复
热议问题