本文介紹了將光標放在 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());
這篇關于將光標放在 EditText 中文本的末尾的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!