开发者

Force webview to open urls inside application - android app

开发者 https://www.devze.com 2023-02-03 09:30 出处:网络
How开发者_如何转开发 to force WebView to open all the urls inside the application?You need to override the WebViewClient for your WebView.

How开发者_如何转开发 to force WebView to open all the urls inside the application?


You need to override the WebViewClient for your WebView.

See here for the details: it's pretty straight forward.

Notice Step 6 in particular.

To open links clicked by the user, simply provide a WebViewClient for your WebView, using setWebViewClient(). For example:

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.setWebViewClient(new WebViewClient());

That's it. Now all links the user clicks load in your WebView.

0

精彩评论

暂无评论...
验证码 换一张
取 消