简体   繁体   English

RecyclerView行项目允许水平滚动

[英]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... 每个项目(例如卡布局或其他任何项目)都是一个类别项目,每个类别都有多个可以在水平方向上滚动的项目...

I suggested you try this question . 我建议你试试这个问题 for myself is usefull. 对我自己有用。 you must using in every row a Horizontal Recyclerview. 您必须在每一行中使用卧式Recyclerview。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM