WebView does not fill the entire screen of the device or emulator

I am developing an Android application that loads a web application at startup. To achieve this, I use web browsing management. I want my web view to be displayed in full screen so that it makes users feel. I tried all the methods for displaying a full screen webthview, but nothing works. I don’t know what I am missing. I need help with this. Below I publish the code snippets I tried, also the attached screenshots, which show how the web view is also displayed on the emulator and on the mobile device.

Method 1: tried a simple base code

webbrowser.setWebViewClient(new MyWebViewClient()); webbrowser.getSettings().setJavaScriptEnabled(true); webbrowser.loadUrl("http://google.com"); private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } 

Method 2: Tried setting the theme as a full-screen manifest file

  <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> 

Method 3: Tried to do this with code

 //Full screen requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

Method 4: Tried with ChromeClient

 mWebView.setWebChromeClient(new MyWebChromeClient()); mWebView.addJavascriptInterface(new DemoJavaScriptInterface(), "demo"); mWebView.loadUrl("http://google.com/"); 

Method 5: Tried just defining webview without layout in main.xml

 <?xml version="1.0" encoding="utf-8"?> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview_compontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="none" /> 

Method 6: also tried with relative layout, aligning the edges of the webview with the parent

Nothing worked for me. The device I'm testing with is the samsung galaxy tab and the Android 2.3.3 emulator. In the galaxy’s 7-inch tab, it appears in the middle, and spaces appear on four sides. While in the emulator its outgoing space is below.

I really appreciate if anyone can direct me to this.

+8
android screen-size resolution webview
source share
3 answers

just a declaration in the manifest of the following code:

<P β†’
 <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" /> 
+9
source share

mWebView.setWebChromeClient (new MyWebChromeClient ());

remove this java code from activity.java file then se,

0
source share

just remove the pad from your layout ...

0
source share

All Articles