Opening webview not in new browser

前端 未结 9 1778
走了就别回头了
走了就别回头了 2020-11-28 09:14

I am implementing a webview. I want two buttons on the top of the web page.

I have one vertical linear layout, inside of which is one horizontal layout with two but

9条回答
  •  忘掉有多难
    2020-11-28 09:42

    My XML implementation:

    
    
    
    
    
    

    My Java implementation:

    WebView webView;
    public final String GlobalUrl = "http://slashdot.org/";
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_application_activity);
    
        webView = (WebView) findViewById(R.id.webView);
        loadWebViewLoad(webView);
    }
    
    private void loadWebViewLoad(WebView webview) {
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        webview.getSettings().setSupportMultipleWindows(true);
        webview.setWebViewClient(new WebViewClient());
        webview.setWebChromeClient(new WebChromeClient());
        webview.loadUrl(GlobalUrl);
    }
    

    And final result is:

提交回复
热议问题