Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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);
like image 872
user782104 Avatar asked Jan 29 '14 02:01

user782104


People also ask

How do I disable scrolling in WebView?

If you subclass Webview, you can simply override onTouchEvent to filter out the move-events that trigger scrolling. public class SubWebView extends WebView { @Override public boolean onTouchEvent (MotionEvent ev) { if(ev. getAction() == MotionEvent. ACTION_MOVE) { postInvalidate(); return true; } return super.

How do I turn off scroll animation in flutter?

How do I stop list view scrolling in flutter? Flutter ListView – Never Scrollable You can make the ListView widget never scrollable by setting physics property to NeverScrollableScrollPhysics().

What is BouncingScrollPhysics?

What is bouncing scroll physics flutter? BouncingScrollPhysics class Null safety. Scroll physics for environments that allow the scroll offset to go beyond the bounds of the content, but then bounce the content back to the edge of those bounds. This is the behavior typically seen on iOS.


2 Answers

I believe this will work:

mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
like image 101
Coeffect Avatar answered Oct 13 '22 06:10

Coeffect


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.

like image 32
RestInPeace Avatar answered Oct 13 '22 07:10

RestInPeace