How to make a full screen webview

后端 未结 7 853
离开以前
离开以前 2020-12-15 07:51

How to make the webview of an android application full screen. I have added the webview on a layout xml file but it doesn\'t stretches out till the edges of the layout, ther

7条回答
  •  情深已故
    2020-12-15 08:31

    Android Version: 4.2.2 - Device: Vega Tablet

    WebView to Hide Status and System Bar and displaying complete screen I followed these steps.

    AndroidManifest.xml

    
        
            
                
                
            
        
    
    

    MainActivity.java

    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(0x10);
    setContentView(R.layout.activity_main);
    String url = "http://edition.cnn.com/";
    WebView webView = (WebView) findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setUserAgentString("Desktop");
    webView.loadUrl(url);
    

    The above process worked for me and my app is displayed in complete screen.

提交回复
热议问题