如何在edittext的光标位置插入数据等

1.获取光标位置
 

int index = editText.getSelectionStart();  
 
int index = editText.getSelectionStart();


2.在光标处插入字符
 
int index = editText.getSelectionStart();  
Editable editable = editText.getText();  
editable.insert(index, "插入的内容");  


 3.删除光标前字符
 
int index = editText.getSelectionStart();  
Editable editable = editText.getText();  
editable.delete(index-1, index);  



你可能感兴趣的:(android,EditText,edittext获取光标位置)