使用CoordinatorLayout+AppBarLayout+NestedScrollView悬浮停靠 再使用SmartSwipeRefresh下拉刷新造成滑动冲突

问题 :
使用CoordinatorLayout+AppBarLayout+NestedScrollView悬浮停靠   再使用SmartSwipeRefresh下拉刷新造成滑动冲突(拉到任何位置都能刷新)
解决方案:
监听AppBarLayout  当滑动到头部位置开启刷新  其余的不刷新
abLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
    @Override
    public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
  
        if (smartSwipeRefresh != null) {
            if (i == 0) {

                smartSwipeRefresh.enableRefresh(); //立即开启刷新
            } else {

                smartSwipeRefresh.disableRefresh();
            }
        }
    }
});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章