How to move the card view rest to the next card view in recyclerView in android

丶灬走出姿态 提交于 2020-01-06 08:08:44

问题


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?


回答1:


There are LayoutManager for RecyclerView which handle the task of laying out the content in particular way.

For example, if you use GridLayoutManager, you'll be able to show the items in Grids, like the Gallery app.

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)

Above LayoutManager will make the content to be laid out horizontally.



来源:https://stackoverflow.com/questions/56438584/how-to-move-the-card-view-rest-to-the-next-card-view-in-recyclerview-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!