Anh*_*hạm 4 tags android android-recyclerview
我正在尝试使用 RecyclerView 在我的应用程序中以编程方式显示标签。它会像这样(抱歉,我现在无法将图像上传到 stackoverflow)
那么,我如何创建 RecyclerView 从左到右显示我的内容并在 RecyclerView 右边缘自动换行看起来像图像并防止其水平滚动?谢谢你的帮助!
使用 实现“com.google.android:flexbox:1.0.0”
只需添加到您的回收视图中
val decoration = DividerItemDecoration(context, RecyclerView.HORIZONTAL)
decoration.setDrawable(ContextCompat.getDrawable(context, R.drawable.divider_10dp)!!)
recyclerViewSelectionList.addItemDecoration(decoration)
val layoutManager = FlexboxLayoutManager(this)
layoutManager.flexDirection = FlexDirection.ROW
layoutManager.justifyContent = JustifyContent.FLEX_START
recyclerViewSelectionList.layoutManager = layoutManager
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2249 次 |
| 最近记录: |