禁止RecycleView滑动
Posted 牛皮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了禁止RecycleView滑动相关的知识,希望对你有一定的参考价值。
参考链接 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滑动的主要内容,如果未能解决你的问题,请参考以下文章
setOnClickListener RecycleView(在一个片段中)导航到另一个片段