首页 > 其他 > 详细

禁止RecycleView滑动

时间:2017-07-10 11:56:54      阅读:434      评论:0      收藏:0      [点我收藏+]

参考链接 http://stackoverflow.com/questions/30531091/how-to-disable-recyclerview-scrolling

public class CustomGridLayoutManager extends LinearLayoutManager {
 private boolean isScrollEnabled = true;

 public CustomGridLayoutManager(Context context) {
  super(context);
 }

 public void setScrollEnabled(boolean flag) {
  this.isScrollEnabled = flag;
 }

 @Override
 public boolean canScrollVertically() {
  //Similarly you can customize "canScrollHorizontally()" for managing horizontal scroll
  return isScrollEnabled && super.canScrollVertically();
 }
}

禁止滑动是调用setScrollEnabled(false);

再打开滑动是调用setScrollEnabled(false);

禁止RecycleView滑动

原文:http://www.cnblogs.com/niupi/p/7144821.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!