Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webview showing white bar on right side

Tags:

android

People also ask

Is Android WebView deprecated?

This interface was deprecated in API level 12. This interface is now obsolete.

What is the WebView layout on Android?

The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

How do I turn off click on WebView?

Open Play Store on your device, search for Android System WebView and click on it. Now you can see the option of Disable, press it, the app is now disabled.


Use the following to hide but not remove the functionality of the scrollbar. The layout margin adjustment is a nasty work-around.

//webview being your WebView object reference. webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);


I would set margin: 0 and padding: 0 inside the . You could do something like

<body style="margin: 0; padding: 0">

This may not be the "best" answer but it worked for me.

<WebView android:layout_marginRight="-7dip" />

Let me know if there is something better because this feels hackish to me.


My app has a selectable night-mode which switches to white on black. The central View is a WebView displaying text.

For night-mode I used an extra css file that showed white text on a black backbround but users complained about the white scrollbar on the right. So I had much the same problem as outlined above. However, I needed to switch in and out of night-mode programatically at runtime but I didn't want merely to hide the scrollbars.

The simple solution I used was:

if (isNightMode()) {
    webView.setBackgroundColor(Color.BLACK);
} else {
    webView.setBackgroundColor(Color.WHITE);
}

Setting the backgroundColor of the WebView affected the scrollbars as required.