我试图在交错边缘视图中添加滚动侦听器
在这里,我想不出一种方法来添加我所看到的没有实现
GITHUB URL
https://github.com/maurycyw/StaggeredGridView
谢谢
最佳答案
创建一个继承swiperFreshLayout并重写canChildScrollUp()方法的类,以检查StaggerEdgridView是否到达顶部,如果到达顶部则返回true否则返回false。
public class SwipeDownToRefrsh extends SwipeRefreshLayout{
PullToRefreshStaggeredGridView pullToRefreshStaggeredGridView;
public SwipeDownToRefrsh(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public void canChildScrollUp (PullToRefreshStaggeredGridView pullToRefreshStaggeredGridView) {
this.pullToRefreshStaggeredGridView = pullToRefreshStaggeredGridView;
}
@Override
public boolean canChildScrollUp() {
// TODO Auto-generated method stub
if (pullToRefreshStaggeredGridView == null) {
return true;
} else {
return !pullToRefreshStaggeredGridView.getRefreshableView().mGetToTop;
}
}
}
在您的活动或片段中,只需像这样发送StaggeredGridView的瞬间:
(swipedowntorefrsh)holder.swiperefreshlayout.canchildscrollup(holder.staggeredridview);