问题
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