Disabling Android's Chrome Pull-Down-To-Refresh Feature

Disabling android's chrome pull-down-to-refresh feature

The default action of the pull-to-refresh effect can be effectively prevented by doing any of the following :

  1. preventDefault’ing some portion of the touch sequence, including any of the following (in order of most disruptive to least disruptive):

    • a. The entire touch stream (not ideal).
    • b. All top overscrolling touchmoves.
    • c. The first top overscrolling touchmove.
    • d. The first top overscrolling touchmove only when 1) the initial touchstart occurred when the page y scroll offset was zero and 2) the touchmove would induce top overscroll.
  2. Applying “touch-action: none” to touch-targeted elements, where appropriate, disabling default actions (including pull-to-refresh) of the touch sequence.
  3. Applying “overflow-y: hidden” to the body element, using a div for scrollable content if necessary.
  4. Disabling the effect locally via chrome://flags/#disable-pull-to-refresh-effect).

See more

How to apply pull to refresh feature like chrome in web-view android studio?

if you want to keep the loading till the page loaded you don't have to use mySwipeRefreshLayout.setRefreshing(false) inside your refresh listener , because your are disabling it just after the refresh start.

instead you have to use it when your loading is done . let say as example you have a webview , so you should listen on the webview progress like this example :

mWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
mySwipeRefreshLayout.setRefreshing(false);
}
});

How to disable pull to refresh action and use only indicator?

From the documentation:

If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view.

So to show the animation:

swiperefreshLayout.setEnabled(true);
swiperefreshLayout.setRefreshing(true);

And to hide the animation:

swiperefreshLayout.setRefreshing(false);
swiperefreshLayout.setEnabled(false);

Disable pull-to-refresh in iOS 15 Safari

Ths 2013 library called iNoBounce (https://github.com/lazd/iNoBounce) actually still does the trick pretty well on iOS 15.

Straightforward replication of the example in the documentation did disable the pull to refresh.



Related Topics



Leave a reply



Submit