且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

安卓:插入文字的EditText在当前位置

更新时间:2023-01-28 07:56:38

尝试使用 EditText.getSelectionStart()获取光标的当前位置。然后你可以使用String.subString前后光标之后获得的文本,在中间插入文本。

Try using EditText.getSelectionStart() to get the current position of the cursor. Then you can use String.subString to get the text before and after the cursor and insert your text in the middle.

没有尝试过,但。