How to disable the bounce effect (blue shade when scroll to end) of webview in android?
Asked Answered
P

3

10

I found the webview is similar to scroll view , that means when I scroll the view to the end, there will be a blue shade at the end of the view (if it is >4.0) . So, how to disable the behavior of this? How to disable the bounce effect? Thanks.

    mWebView.setWebViewClient(new MyWebViewClient(getActivity()));
    chromeCilent = new MyWebChromeClient(getActivity());
    mWebView.setWebChromeClient(chromeCilent);
    mWebView.getSettings().setDomStorageEnabled(true);
    mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setLoadsImagesAutomatically(true);
    mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
    mWebView.getSettings().setSupportZoom(false);
    mWebView.getSettings().setSavePassword(false);
    mWebView.getSettings().setBlockNetworkImage(false);
    mWebView.getSettings().setSupportMultipleWindows(false);
    mWebView.getSettings().setAppCacheEnabled(true);
    mWebView.addJavascriptInterface(this, "jsinterface");

    // default go to video page
    mWebView.loadUrl(url);
Pietje answered 29/1, 2014 at 2:54 Comment(0)
O
20

I believe this will work:

mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
Orthogenic answered 29/1, 2014 at 3:7 Comment(0)
H
21

If you want to disable the effect directly in the layout XML resource, you may use:

android:overScrollMode="never"

This is effectively equivalent to Coeffect's solution.

A benefit of doing this in the xml file rather than in Java code is that you do not need to create an ID of the view to disable the effect. In Java you would need the ID to get reference to the view to disable the effect, while in xml you can directly use the above attribute without having to create the ID.

Helenahelene answered 17/9, 2014 at 9:55 Comment(1)
plus 1 for explaining why xml is betterAcquah
O
20

I believe this will work:

mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
Orthogenic answered 29/1, 2014 at 3:7 Comment(0)
C
0

This worked for me

<WebView
  source={{html}}
  overScrollMode={'never'}
/>
Copyright answered 29/8 at 2:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.