[英]RecyclerView row items allowing horizontal scroll
Can I make the RecyclerView row items to allow horizontally scrolling? 我可以使RecyclerView行项目允许水平滚动吗? Each item (card layout for example or any other) is a category item and each category has multiple items that can be scrolled on horizontal... 每个项目(例如卡布局或其他任何项目)都是一个类别项目,每个类别都有多个可以在水平方向上滚动的项目...
set Orientation to RecyclerView 将方向设置为RecyclerView
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setAdapter(myAdapter = new MyAdapter(getBaseContext(), myData, myLayout);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
// for horizontal
linearLayoutManager.setOrientation(LinearLayout.HORIZONTAL);
// for vertical
linearLayoutManager.setOrientation(LinearLayout.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.