怎么获取光标在那个EDITTEXT里面
2017-05-08
展开全部
1.获取光标位置
[java] view plain copy
int index = editText.getSelectionStart();
2.在光标处插入字符
[java] view plain copy
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, "aaaa");
3.删除光标前字符
[java] view plain copy
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.delete(index-1, index);
[java] view plain copy
int index = editText.getSelectionStart();
2.在光标处插入字符
[java] view plain copy
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.insert(index, "aaaa");
3.删除光标前字符
[java] view plain copy
int index = editText.getSelectionStart();
Editable editable = editText.getText();
editable.delete(index-1, index);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询