问题描述
我正在创建有关餐厅自动化的应用程序厨房显示.创建订单时,将其添加到回收站"视图中可以水平滚动.在每个订单中添加到每个Cardview的商品,如果还有更多商品,我需要将剩余的商品放入下一列.显示了图像(每个订单无法滚动)有什么建议或方法吗?
I am creating an application kitchen display regarding restaurant automation. When creating the order it is added to the Recycler view can scroll horizontally.Item added to each Cardview in each order and if more item includes I need to the rest into the next column. image is shown it (Each order can't the scroll)Are there any suggestions or method to do this?
推荐答案
RecyclerView
的LayoutManager
用于处理以特定方式布置内容的任务.
There are LayoutManager
for RecyclerView
which handle the task of laying out the content in particular way.
例如,如果您使用GridLayoutManager
,则可以在网格"中显示项目,例如图库"应用.
For example, if you use GridLayoutManager
, you'll be able to show the items in Grids, like the Gallery app.
在这种情况下,您必须使用水平方向的LinearLayoutManager
.您可以按照以下步骤进行操作:
In your case, you'll have to use LinearLayoutManager
, with the horizontal orientation. 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)
在LayoutManager上方,将使内容水平放置.
Above LayoutManager will make the content to be laid out horizontally.
这篇关于如何在Android的recyclerView中将卡片视图其余部分移动到下一个卡片视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!