将光标放在 EditText 中文本的末尾
我正在更改 keyListener 上的 EditText 的值.
I am changing the value of an EditText on keyListener.
但是当我更改文本时,光标会移动到 EditText 的开头.我需要光标在文本的末尾.
But when I change the text the cursor is moving to the beginning of the EditText.
I need the cursor to be at the end of the text.
如何将光标移动到 EditText 中的文本末尾.
How to move the cursor to the end of the text in a EditText.
推荐答案
试试这个:
更新:
科特林:
editText.setSelection(editText.length())//placing cursor at the end of the text
Java:
editText.setSelection(editText.getText().length());
相关文章