Open URL in WebView instead of default Browser

前端 未结 6 1904
不思量自难忘°
不思量自难忘° 2020-12-30 07:19

I am creating simple Webview application with some links on textview and open those links in webview instead of default browser. My

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 07:53

    WebView wv = (WebView) findViewById(R.id.webView1);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.getSettings().setSupportZoom(true);      
    
    wv.getSettings().setBuiltInZoomControls(true);
    
    wv.setWebViewClient(new WebViewClient()
    {
        // Links clicked will be shown on the webview
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            return super.shouldOverrideUrlLoading(view, url);
        }   
    }); 
    wv.loadUrl(url);
    

提交回复
热议问题