首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

textView获取选中的一部分

2012-08-21 
textView获取选中的部分int selectionStart textView.getSelectionStart()?? ? int selectionEnd tex

textView获取选中的部分

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

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

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

热点排行