简体   繁体   English

如何将卡片视图移动到android中的recyclerView中的下一个卡片视图

[英]How to move the card view rest to the next card view in recyclerView in android

I am creating an application kitchen display regarding restaurant automation. 我正在创建一个关于餐厅自动化的应用厨房展示。 When creating the order it is added to the Recycler view can scroll horizontally. 创建订单时,它会添加到Recycler视图中,可以水平滚动。 Item added to each Cardview in each order and if more item includes I need to the rest into the next column. 项目在每个订单中添加到每个Cardview,如果更多项目包括,我需要将其余部分添加到下一列。 image is shown it (Each order can't the scroll) Are there any suggestions or method to do this? 图像显示它(每个订单不能滚动)是否有任何建议或方法来做到这一点? 在此输入图像描述

There are LayoutManager for RecyclerView which handle the task of laying out the content in particular way. LayoutManagerRecyclerView其处理奠定了特别的方式内容的任务。

For example, if you use GridLayoutManager , you'll be able to show the items in Grids, like the Gallery app. 例如,如果您使用GridLayoutManager ,您将能够在网格应用中显示网格中的项目。

In your case, you'll have to use LinearLayoutManager , with the horizontal orientation. 在您的情况下,您将必须使用水平方向的LinearLayoutManager You can do that as follows: 你可以这样做:

LinearLayoutManager layoutManager
    = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
recyclerView.setLayoutManager(layoutManager)

Above LayoutManager will make the content to be laid out horizontally. LayoutManager上方将使内容水平布局。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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