Reputation: 7013
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.
Upvotes: 8
Views: 5115
Reputation: 1
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);
Upvotes: 0
Reputation: 17813
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
Upvotes: 0
Reputation: 567
You can send loader away
yourSwipeToRefresh?.setProgressViewEndTarget(true, -screenHeight)
Upvotes: 0
Reputation: 7013
After Done some RnD found a solution that may help others who want to achieve such functionality
try {
Field f = mSwipeRefreshLayout.getClass().getDeclaredField("mCircleView");
f.setAccessible(true);
ImageView img = (ImageView)f.get(mSwipeRefreshLayout);
img.setAlpha(0.0f);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
Upvotes: 21