我正在开发一个应用程序,我需要像提供的图像这样的布局。
GridView
和有什么区别和 GridLayout
?为什么他们在遗留部分?什么是替代方案和最佳实践? 以下是我需要开发的布局。我可以做到这一点
布局方式很多,但我需要知道最佳实践。
最佳答案
我相信我遇到了同样的问题。从上面的谷歌文档网站和这个答案 GridView VS GridLayout in Android Apps ,我有线索了。
GridLayoutManager arranges the items in a two-dimensional grid, like the squares on a checkerboard. Using a RecyclerView with GridLayoutManager provides functionality like the older GridView layout.
StaggeredGridLayoutManager arranges the items in a two-dimensional grid, with each column slightly offset from the one before, like the stars in an American flag.
Google 还在 https://github.com/android/views-widgets-samples 上提供了用于回收站 View 的示例代码
这些是我查看的网站:
关于android - GridView、GridLayout 和 Recycler View 与 GridLayout 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53562998/