禁用 WebView 中的可选链接
我有一个包含在 scrollView
中的 webView
。所有内容都包含在 viewPager
中。当我跳到下一个视图页面时,页面中间的链接将被聚焦(文本周围以橙色突出显示)。这会导致页面跳转到最近的链接。
有没有办法禁止链接在触摸时聚焦?我已经尝试了 webView
的所有设置,例如 focusable = false
、clickable = false
、focusable in touch mode = false
,似乎没有任何效果。
I have a webView
that is contained within a scrollView
. Everything is then contained within a viewPager
. When I fling to the next view page, the links that are in the middle of the page are being focused (highlighted with orange around the text). This causes the page to jump down to the nearest link.
Is there a way to disable links from being focusable on touch? I've tried all the settings for the webView
such as focusable = false
, clickable = false
, focusable in touch mode = false
, and nothing seems to be working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我设法以编程方式做到这一点,如下所示:
这使得链接不可聚焦,这解决了我的问题!
I managed to do it programmatically like so:
This makes the links non-focusable, which solved my problem!
这可以防止网络视图打开任何链接,并且还可以让您毫无问题地导航页面
This prevents the webview from opening any links and will also allow you to navigate the page without problems