It seems that a WebView element in Android reserves some space for a vertical scrollbar by default. This shows up as a small, vertical strip of white space on the right, which is not padding or margin but some space reserved for a scrollbar.

To get rid of this you have to set the scrollbar style to display the scrollbars inside the content area. This can be done with the following code:

webview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

2 comments on Getting rid of extra WebView space on the right

  1. Sandeep Kharat says:

    it works fine. thanks.

  2. Mic says:

    myWebView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY);

    where “myWebView” WebView type variable.