gpt4 book ai didi

android - 具有包装内容项水平和垂直滚动的回收器 View

转载 作者:太空宇宙 更新时间:2023-11-03 13:10:38 25 4
gpt4 key购买 nike

你好,我想制作一个回收器 View ,以将项目水平放置到屏幕适合的数量,但垂直滚动,例如此图像

enter image description here

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

最佳答案

您可以使用 FlexLayoutManager 进行此类设计 FlexLayout

这是在 RecycleView 中使用 FlexLayoutManager 的示例 fragment

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);

它们有很多属性可以使用 FlexLayout 去看看github上的文档

关于android - 具有包装内容项水平和垂直滚动的回收器 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46220389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com