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

后端 未结 8 1917
温柔的废话
温柔的废话 2020-11-28 04:31

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

8条回答
  •  眼角桃花
    2020-11-28 04:35

    Well... After some struggling I eventually solved this problem by myself, in a tricky way...

    I just need to add these in onPause() :

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

提交回复
热议问题