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 :
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.
- Applying “
touch-action: none
” to touch-targeted elements, where appropriate, disabling default actions (including pull-to-refresh) of the touch sequence. - Applying “
overflow-y: hidden
” to the body element, using a div for scrollable content if necessary. - 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
What Does Fragmentmanager and Fragmenttransaction Exactly Do
What Is Metadata ? and What Is The Use of It in Android
Android - Multiple Custom Versions of The Same App
How to Make Grid View Scroll Horizontally Not Vertically in Android
How to Develop Android App Completely Using Python
Best Way to Show a Loading/Progress Indicator
What Are The Semantics of Withvaluebackreference
Android Dialog: Removing Title Bar
Android Studio Two Flavors with Different Manifest Files
How to Remove Child Nodes in Firebase Android
How to Get Raw Preview Data from Camera Object at Least 15 Frames Per Second in Android
Right Align Text in Android Textview
How to Show a Mediacontroller While Playing Audio in Android
How to Get Rid of Incremental Annotation Processing Requested Warning
Eclipse Hangs at The Android Sdk Content Loader
Intercept and Override Http Requests from Webview
Android Studio Run/Debug Configuration Error: Module Not Specified