且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android的recyclerView中将卡片视图其余部分移动到下一个卡片视图

更新时间:2021-08-13 06:28:35

RecyclerViewLayoutManager用于处理以特定方式布置内容的任务.

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.