第一种(有一部分人用了没作用)、、我是NestedScrollView嵌套RecyclerView并设置RecyclerView固定高度,还是起作用了
//初始化网络5列表
GridLayoutManager rlm = new GridLayoutManager(mContext, 5);
recyclerGrideViewFive.setLayoutManager(rlm);
recyclerGrideViewFive.setNestedScrollingEnabled(false);//禁止滑动
第二种 RecyclerView 为垂直状态(VERTICAL)下:
//初始化网络5列表
GridLayoutManager rlm = new GridLayoutManager(mContext, 5){
@Override
public boolean canScrollVertically() {
return false;
}
};
recyclerGrideViewFive.setLayoutManager(rlm);
RecyclerView 为水平状态(HORIZONTAL)下:
LinearLayoutManager layoutManager = new LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false){
@Override
public boolean canScrollHorizontally() {
return false;
}
};
recyclerView.setLayoutManager(layoutManager);