I have a normal NavigationDrawer with different fragments :
- News
- other Stuff 1
- other Stuff 2
- Setting
The problem :
The NewsFragment contains a SwipeRefreshLayout. It works great the first time I refresh.
I can change fragment to other Stuff 1 and 2 and Setting. So I come back to NewsFragment.
And now when I refresh, the fragment freezes.
The drawerLayout works correctly (open/close, even the ActionBar Title change) but the main fragment stay at NewsFragment and I can't scroll. But the scollListner works (I have log) but the view doesn"t change.
No refreshView (top of the swipeRefreshLayout), no scroll, no responding button (on focus, onclick) but only visually.
Actually, it's like a Responding Fragment is behind the frozen fragment.
Also I have this error in ADBLog :
SwipeRefreshLayout﹕ Got ACTION_MOVE event but don't have an active pointer id.
Any idea ??
I can post code if you ask.
This answer worked for me. It's about clearing up the refresh layout in onPause().
Your code example does indeed fix the issue. This seems to be a problem with the v21 support library.
For a little more clarification to help others that might come across this, the issue seems to be that the
SwipeRefreshLayout
is no longer happy being the root view.Adding a
RelativeLayout
to wrap theSwipeRefreshLayout
fixes the bug in your case, rather than just having theListView/RecyclerView
inside theSwipeRefreshLayout
. I've not tried, but I'm guessing aLinearLayout
or other would also fix things.So the fix is:
Ok I found the solution. I post it because it can happen to everybody and that's a little boring (two days to find for me).
First I had this in my XML which contains the SwipeRefreshLayout (a fragment):
So, to fix the bug, YOU NEED TO JUST HAVE THE RECYCLEVIEW (or listview) IN YOUR SWIPEREFRESHLAYOUT :
So, I Move my progressBar and make the RelativeLayout as the rootView.
Result :
I hope it will help someone else later.