Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I enabled "pull to refresh" to my project using the SwipeRefreshLayout.

When I move down, appear the loading indicator (material design style). I know, it must so work, but I want to disable this function, and start refreshing by click some button and use SwipeRefreshLayout loading indicator.

How I can to do this?

like image 426
Александр Шевчук Avatar asked May 18 '15 11:05

Александр Шевчук


People also ask

How do I stop Pull down to refresh?

You can also use 'Find in page' option for automatic searching by tapping on 3 dots on upper right corner of the screen . Tap on Find in page for automatic searching. In “The pull-to-refresh effect Android” , click on Disable button. Select 'Always' and tap on RELAUNCH NOW button to disable pull-to-refresh feature.

How do you use SwipeRefreshLayout?

Add the SwipeRefreshLayout Widget To add the swipe to refresh widget to an existing app, add SwipeRefreshLayout as the parent of a single ListView or GridView . Remember that SwipeRefreshLayout only supports a single ListView or GridView child. You can also use the SwipeRefreshLayout widget with a ListFragment .


1 Answers

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); 
like image 111
nhasan Avatar answered Sep 20 '22 08:09

nhasan