Questions tagged [swiperefreshlayout]

SwipeRefresLayout is a standard way to implement the common Pull to Refresh pattern in Android.

Description

The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. The activity that instantiates this view should add an OnRefreshListener to be notified whenever the swipe to refresh gesture is completed. The SwipeRefreshLayout will notify the listener each and every time the gesture is completed again; the listener is responsible for correctly determining when to actually initiate a refresh of its content. If the listener determines there should not be a refresh, it must call setRefreshing(false) to cancel any visual indication of a refresh. 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.

Link

Android Developer

685 questions
146
votes
14 answers

SwipeRefreshLayout setRefreshing() not showing indicator initially

I have a very simple layout but when I call setRefreshing(true) in onActivityCreated() of my fragment, it does not show initially. It only shows when I do a pull to refresh. Any ideas why it isn't showing up initially? Fragment…
thunderousNinja
  • 3,510
  • 9
  • 37
  • 49
99
votes
9 answers

SwipeRefreshLayout + ViewPager, limit horizontal scroll only?

I've implemented SwipeRefreshLayout and ViewPager in my app but there is a big trouble: whenever I'm going to swipe left / right to switch between pages the scrolling is too sensitive. A little swipe down will trigger the SwipeRefreshLayout refresh…
user3896501
  • 2,987
  • 1
  • 22
  • 25
94
votes
2 answers

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…
75
votes
8 answers

When switch fragment with SwipeRefreshLayout during refreshing, fragment freezes but actually still work

UPDATE: I thought it worked correctly. But after some test trouble still exists *sniff* Then I made a simpler version to see what exactly happen and I get to know that the refreshing fragment which should have been detached still left there. Or…
71
votes
7 answers

SwipeRefreshLayout trigger programmatically

Is there any way to trigger the SwipeRefreshLayout programmatically? The animation should start and the onRefresh method from the OnRefreshListener interface should get called.
Niklas
  • 23,674
  • 33
  • 131
  • 170
68
votes
6 answers

Android: CollapsingToolbarLayout and SwipeRefreshLayout get stuck

I use CollapsingToolbarLayout, RecyclerView and SwipeRefreshLayout together: Xml:
Tomas
  • 4,652
  • 6
  • 31
  • 37
65
votes
14 answers

RecyclerView and SwipeRefreshLayout

I'm using the new RecyclerView-Layout in a SwipeRefreshLayout and experienced a strange behaviour. When scrolling the list back to the top sometimes the view on the top gets cut in. If i try to scroll to the top now - the Pull-To-Refresh triggers.…
Lukas Olsen
  • 5,294
  • 7
  • 22
  • 28
58
votes
5 answers

HorizontalScrollView inside SwipeRefreshLayout

I implemented the new SwipeRefreshLayout component in my application and it works well with any vertical views, like ListView, GridView and ScrollView. It behaves very bad with horizontal views, like HorizontalScrollView. When scrolling to the right…
Lior Iluz
  • 26,213
  • 16
  • 65
  • 114
49
votes
1 answer

Android: CoordinatorLayout and SwipeRefreshLayout

I try to implement auto hiding toolbar feature from the new support library 22.2.0. Without SwipeRefreshLayout is working fine: But when I re add this layout, toolbar overlap the recyclerview: Code:
Tomas
  • 4,652
  • 6
  • 31
  • 37
39
votes
4 answers

How to set SwipeRefreshLayout refreshing property using android data binding?

I am using android data binding library. If I want to make a view visible I can write something like this:
daneejela
  • 13,081
  • 7
  • 38
  • 50
39
votes
3 answers

SwipeRefreshLayout disable drag animation on swipe down

Is it possible to disable SwipeRefreshLayout drag animation on swipe down without class customization?
Alexander Zhak
  • 9,140
  • 4
  • 46
  • 72
39
votes
12 answers

Scroll up does not work with SwipeRefreshLayout in Listview

I want to implement scroll to refresh functionality with a listView. Also there are other view elements in the same layout file which are displayed if the list is empty. Here is my layout file. The problem is that when I scroll down and then try to…
user3773337
  • 2,086
  • 4
  • 20
  • 29
39
votes
16 answers

SwipeRefreshLayout + WebView when scroll position is at top

I'm trying to use SwipeRefreshLayout with WebView. I'm facing the problem where in the middle of page, when user scrolls down, unwanted refresh kicks in. How do I make the refresh event only happen when webview's scroll position is at the top. (ie,…
eugene
  • 39,839
  • 68
  • 255
  • 489
38
votes
6 answers

SwipeRefreshLayout behind ActionBar

When using a SwipeRefreshLayout in combination with a overlay mode ActionBar, the loading animation will be displayed behind the actionbar, making it almost invisible. Is there anything I can do to show it on top of the actionbar?
Frank
  • 12,010
  • 8
  • 61
  • 78
37
votes
5 answers

How to use the SwipeRefreshLayout?

Background Google has recently published an update to its support library, which now has a new "SwipeRefreshLayout" view. The view allows to wrap another view, while supporting swiping down in order to perform a refresh operation. screenshot: The…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
1
2 3
45 46