我如何在 android 中像 gridview 一样在水平和垂直方向添加框布局

how can i add box layout both in horizontally and vertical like gridview in android

我想在 android.this 中添加动态布局 布局应该是水平的 vertically.like

喜欢gridview

我有同样的要求,我使用 FlowLayout 解决了我的问题。示例代码和参考资料可用 on github 使用简单。 希望对您有所帮助。

您可以将线性布局与 属性 android:orientation="vertical" 用于垂直按钮和 android:orientation="horizontal" 用于水平按钮。 同样使用 weight 属性 的 linearLayout

使用嵌套线性布局并更改方向 属性。查看此库可能会有帮助

https://github.com/Comcast/FreeFlow