开发者

Android edittext - settextmethod cursor issue

开发者 https://www.devze.com 2023-02-14 01:54 出处:网络
I am trying to settext in an开发者_StackOverflow中文版 EditText...But after setText is done, the cursor remains at the start of text.how can i move it to the end of the text?

I am trying to settext in an开发者_StackOverflow中文版 EditText...But after setText is done, the cursor remains at the start of text.how can i move it to the end of the text?

Any help in this regard is appreciated.

Best Regards, Rony


EditText inputField;
Editable etext = inputField.getText();
int position = etext.length();
inputField.setSelection(position);


Use append(CharSequence text). This will also update the position of the cursor. See Android Documentation


Try append("Hello"); instead of setText()

0

精彩评论

暂无评论...
验证码 换一张
取 消