SwipeRefreshLayout Without Progress Spinner

Viewed 3796

Is it possible to perform SwipeRefreshLayout functionality without showing progress spinner all together. Right now its working perfectly fine with its default behavior of pull to refresh shows Progress spinner and onRefresh() I hide It. But I want to hide it all together just want to use the pull to refresh functionality but without progress spinner.

6 Answers

swipeRefreshLayout.setProgressViewEndTarget(false, 0)

You can send loader away

yourSwipeToRefresh?.setProgressViewEndTarget(true, -screenHeight)

I don't agree with hiding this spinner completely. but untill the loading starts then hiding it. I have in my layout many in-progress UIs .. so what I have done:

app:refreshing="@{vm.loadingUI1  && vm.loadingUI2  && false}">

loadingUI1 is LiveData

With this approach you show interactive loading as action only and it will be hidden immediately when loading-process starts with any component

In addition to Atakan Akar's answer and to enable future swipe refreshing:

// Reduses spinner size to 0
swipeRefreshLayout.setProgressViewEndTarget(false, 0); 
// Turns off layout refreshing status
swipeRefreshLayout.setRefreshing(false);

swipe_refresh_layout.setProgressViewOffset( false, -200, -200 )

Related