android EditText获取光标位置并插入字符删除字符
1.获取光标位置
[java]
int index = editText.getSelectionStart();
int index = editText.getSelectionStart();
2.在光标处插入字符
[java]
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, "aaaa");
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, "aaaa");3.删除光标前字符
[java]
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.delete(index-1, index);
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.delete(index-1, index);
补充:移动开发 , Android ,