如何以编程方式从 EditText
中删除选择?我试过:
myEditText.setSelection(selectionEnd);
但这只是在当前选择的末尾创建了一个长度为 0 的选择。我也试过 Selection.removeSelection(mySpannable)
,它只是在文本的开头放置了一个空选择。
最佳答案
调用 myEditText.clearFocus();
。我想这就是你需要的
关于android - 如何清除 EditText 中的选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11534039/