8

TLDR: here's my bug report : http://goo.gl/UgBFW2

Using a SwipeRefreshLayout if I press back and trigger either a getSupportFragmentManager().popBackstack(), super.onBackPressed() or fragmentTransaction.replace() right when the adapter triggers the views refresh, the two fragments overlap (a video showing the problem can be found in the top link).

I tried several things and adding a background is not a solution since the list fragment is in the foreground and the one clickable is the previous fragment.

Has anyone found a solution to this ?

Replacing Fragment does not work properly while swipeRefresh is running

Community
  • 1
  • 1
Cristen
  • 81
  • 4
  • I just ran into the same issue... Do you know if the have been any progress on your bug report? Did you find a workaround? – Joakim Oct 14 '15 at 12:16

4 Answers4

5

Add this to the fragment that contains the swipe

@Override
public void onPause() {
    super.onPause();
    if (swipeRefreshLayout!=null) {
        swipeRefreshLayout.setRefreshing(false);
        swipeRefreshLayout.destroyDrawingCache();
        swipeRefreshLayout.clearAnimation();
    }
}
3

Its a bug. Google may fix it in future.

Android Issue 78062

Michel Fortes
  • 819
  • 8
  • 12
0

Try wrapping the SwipeToRefreshLayout inside a FrameLayout. It fixed the issue for me.

0

Issue I Have Faced

I was facing the same issue in appcompat-v7:25.1.0. I have tried all this below codes still the problem persist

@Override
public void onPause() {
    super.onPause();
    if (swipeRefreshLayout!=null) {
        swipeRefreshLayout.setRefreshing(false);
        swipeRefreshLayout.destroyDrawingCache();
        swipeRefreshLayout.clearAnimation();
    }
}

Solution

If any one facing the same issue Please downgrade appcompat to 25.0.1 and use the above snippet to stop animating the same. It is working fine for me

Askarc Ali
  • 318
  • 4
  • 21