onLongClick了的WebView内的纯文本 [英] onLongClick for plain text inside of a WebView

查看:112
本文介绍了onLongClick了的WebView内的纯文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个包含将被用来显示用户的某些环节和某些纯文本的WebView的应用程序。我希望把它使用户可以LongClick链接或文本正文,并得到删除从正在web视图显示的HTML这就是那个东西的选项。 这个问题让我走了一半。 LongClicking上的链接通过使用wv.getHitTestResult()方法的工作原理。但现在我的问题是,当我在纯文本长单击该侦听器的onLongClick()方法不会被调用,即使它确实getHitTestResult()将不会返回该用户触摸文本(我试着设置一个onTouchListener看是否getHitTestResult()。getExtra()有一个值时,我感动纯文本)

I am building an app that contains a WebView which will be used to show the user some links and some plain text. I want to make it so that the user can LongClick on a link, or a body of text and get the option to delete that thing from the html thats being shown in the WebView. This question got me half way there. LongClicking on the links works by using the wv.getHitTestResult() method. But now my problem is when I long click on plain text the onLongClick() method of the listener doesn't get called, and even if it did getHitTestResult() would not return the text that the user is touching(I tried setting an onTouchListener to see if getHitTestResult().getExtra() had a value when I touched plain text)

所以我的问题是没有人知道我可以得到一个web视图是对未Linkified文本里面LongClick活动?(我认为这是可能的一些如何,因为这是我可以选择在默认浏览器文本) 。一旦我得到的LongClick事件?我怎样才能获得被点击到文本的身体?

So my questions is does anyone know how I can get LongClick events inside of a WebView that are on text that is not Linkified?(I assume this is possible some how because that is how I can select text in the default browser). and once I get the LongClick event how can I get access to which body of text was clicked?

推荐答案

我来到这里的答案,

http://stackoverflow.com/a/5908125/1503130

此外,如果您有任何其他修复的问题然后做分享。

Also if you have any other fix to the problem then do share it.

这篇关于onLongClick了的WebView内的纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆