SwipeRefreshLayout - swipe down to refresh but not move the view pull down

前端 未结 5 1877
深忆病人
深忆病人 2020-12-08 12:29

Is it possible ?? as a Title said

swipe down to refresh Layout but stick the Layout not move it down along swipe gusture

Thank you - I\'m us

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 12:40

    I was also facing same issue. try this:

    guidesList.setOnScrollListener(new AbsListView.OnScrollListener() {  
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
        }
    
        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int   visibleItemCount, int totalItemCount) {
    
            int topRowVerticalPosition = (guidesList == null || 
                guidesList.getChildCount() == 0) ? 0 : guidesList.getChildAt(0).getTop();
    
            swipeContainer.setEnabled(firstVisibleItem == 0 && topRowVerticalPosition >= 0);
        }
    });
    

提交回复
热议问题