本文介绍了如何将回收站视图的项目居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将每一行的元素居中,这样它们就会像这个模型中的一样.我一直在寻找是否有任何布局可以在不看的情况下以这种方式工作.项目在其行中居中.
I need to center elements in each row so they will be like in this mockup.I've been searching if there is any layout that works that way without look.items are centered in their rows.
这就是它现在在我的代码中的样子.
This is how it looks now in my code.
推荐答案
实现:
recycler.adapter = MyAdapter()
val layoutManager FlexboxLayoutManager( context: this)
layoutManager.justifyContent = JustifyContent.CENTER
layoutManager.alignItems = AlignItems.CENTER
layoutManager.flexDirection = FlexDirection. ROW layoutManager.flexWrap = FlexWrap.WRAP
my recycler.layout Manager = = layout Manager
这篇关于如何将回收站视图的项目居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!