[英]How can i get clicked text on long press or on click?
I have one TextView, I want to get the text what user clicked by long press in TextView.我有一个 TextView,我想获取用户在 TextView 中长按点击的文本。
TextView is already selectable. TextView 已经是可选的。
Suppose there is the line "This is my book" in TextView.假设 TextView 中有一行“这是我的书”。 If user click(select) on "book", I want to get that word on long press or onclick.
如果用户点击(选择)“书”,我想通过长按或点击获得该词。
can somebody please help?有人可以帮忙吗?
Inside your Text View tag place在您的文本视图标签位置内
android:textIsSelectable=true
android:textIsSelectable=true
you can also change the selected text highlighted color.您还可以更改所选文本突出显示的颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.