读书人

textView获取选中的一部分

发布时间: 2012-08-21 13:00:22 作者: rapoo

textView获取选中的部分

int selectionStart = textView.getSelectionStart();?
? ? int selectionEnd = textView.getSelectionEnd();?
String selectedText = et.getText().substring(selectionStart, selectionEnd);?

不过最好经过hasSelection() 判断一下

1 楼 javetu_7 2010-07-28 实现不了吧。使用getSelectionStart()必须有光标才能实现的.

读书人网 >移动开发

热点推荐