Android WebView Scrollable

39,293

The WebView documentation says:

By default, a WebView provides no browser-like widgets

It also says:

A WebView has several customization points where you can add your own behavior. These are:

...

Creating and setting a WebViewClient subclass. It will be called when things happen that impact the rendering of the content, eg, errors or form submissions. You can also intercept URL loading here.

Which suggests WebViewClient has nothing to do with the scroll bars, since they're not content.

I was going to suggest putting a WebView inside of a ScrollView, but looking at this link it seems WebView's default behaviour is to include scroll bars, which makes sense since a lot of scrollbar functionality is defined in the high level View class. Have you tried just making a regular WebView? If so, have you tried adding the following in your java code?

WebView v = (WebView) findViewById(R.id.webview); 
v.setVerticalScrollBarEnabled(true);
v.setHorizontalScrollBarEnabled(true);
Share:
39,293
Sultan Saadat
Author by

Sultan Saadat

Updated on September 05, 2020

Comments

  • Sultan Saadat
    Sultan Saadat over 3 years

    I'm making a browser based on android WebView class. I want to enable both horizontal and vertical scrolls on the webview and want it to behave exactly like the android browser? Is there any setting for that in the manifest file or shall i override the default webviewclient class.

  • Sultan Saadat
    Sultan Saadat almost 13 years
    Haven't tried making a regular web view because that is not what I need
  • Sultan Saadat
    Sultan Saadat almost 13 years
    And this scrollbar functionality is not working in the custom class