码迷,mamicode.com
首页 > 其他好文 > 详细

禁止RecycleView滑动

时间:2017-07-10 12:01:46      阅读:440      评论:0      收藏:0      [点我收藏+]

标签:xtend   for   cycle   led   滑动   out   contex   over   vertica   

参考链接 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滑动

标签:xtend   for   cycle   led   滑动   out   contex   over   vertica   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!