获取“链接文字" WebView中显示的链接的形式 [英] Getting "Link text" of the link displayed in WebView
问题描述
我有Android WebView,其中显示了一些链接,如:
<a href="http://link1.html">Link1Text</a>
<a href="http://link2.html">Link2Text</a>
现在,我想检索 Link1Text 和 Link2Text >当我长按这些链接时.我在代码中实现了 contextMenu ,我可以成功获取链接网址( http ://link1.html , http://link2.html ),使用 HitTestResult getExtra() 方法,但是如何获得这些链接文本?
仅供参考,我需要这些链接文本才能在contextMenu中实现复制链接文本"选项.
I have Android WebView which displays some links as:
<a href="http://link1.html">Link1Text</a>
<a href="http://link2.html">Link2Text</a>
Now I would like to retrieve Link1Text and Link2Text when I long press these links. I have contextMenu implemented in the code and I could successfully get the link urls (http://link1.html, http://link2.html) using HitTestResult getExtra() method but how ccan I get those link texts ?
FYI, I require those link texts for implementing "Copy link text" option in the contextMenu.
推荐答案
不幸的是,尚无明确的官方方法来执行此操作.尽管有两个API(selectText和copySelection)正在等待API委员会的批准,这可能有帮助,但是目前尚不可用.
Unfortunately, a clear, official way to do this is not available. Although, there are two APIs (selectText and copySelection) which are pending API council approval, that may help to do this, but they are not available at the moment.
这篇关于获取“链接文字" WebView中显示的链接的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!