且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在web视图,而不是默认的浏览器打开链接

更新时间:2023-11-27 21:47:52

是的,你可以做到这一点,这是pretty的简单,WebView功能的任务,你需要声明的 WebViewClient 对象和覆盖公共布尔shouldOverrideUrlLoading(web视图查看,字符串URL)方法,在那里,你可以过滤网址或给一些自定义的功能。

Yes, you can do that, it's pretty simple task with WebView, you need to declare a WebViewClient object and override the public boolean shouldOverrideUrlLoading (WebView view, String url) method, there you can filter urls or give some customized functionality.

在你的情况下,留在web视图,您将需要返回false上的方法。

In your case, to stay on the WebView, you would need to return false on that method.

查看本教程

问候

编辑:

看来你的问题是如何处理的TextView的URL中的单击事件。由于它的建议在这个问题上可以筛选 ACTION_VIEW 您的WebView包含活动的意图。如果您需要更多关于意图过滤器的指导,检查了这一点

It seems your question is how to handle the click event on the TextView's url. As it's suggested on this question you can filter the ACTION_VIEW intent on your WebView containing Activity. If you need more guidance about intent-filters, check this out.