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.