带有水平和垂直滚动环绕内容项的回收器视图

Ahm*_*ged 5 layout android adapter android-recyclerview

嗨,我想制作一个回收器视图,以将项目水平放置与屏幕适合的数量一样多,但使用垂直滚动,例如此图像

在此处输入图片说明

我尝试使用StaggeredGridLayoutManager但它必须指定列数希望列作为屏幕大小任何帮助都会很好

Bur*_*hid 10

您可以将FlexLayoutFlexLayoutManager用于这种设计

下面是一个例子片段用FlexLayoutManagerRecycleView

RecyclerView recyclerView = (RecyclerView) context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.COLUMN);
layoutManager.setJustifyContent(JustifyContent.FLEX_END);
recyclerView.setLayoutManager(layoutManager);
Run Code Online (Sandbox Code Playgroud)

他们的很多属性都可以使用 查阅FlexLayoutgithub上的文档