并排放置 Imageviews android studio
Put Imageviews side by side android studio
我想创建如图所示的布局,
See it my goal
所以我用 LinearLayout 做了,但结果是这样的:
See it
请问我需要您的帮助才能实现我的目标,
你无法用 LinearLayout
实现。
您需要使用 StaggeredGridView 来获得该结果。
对于演示你可以use this
为您的布局使用 Staggered GridView。它会解决您的问题。
StaggeredGridView 类似于 GridView,但在 GridView 中,您可以在相同大小的框中显示数据,而在 StraggeredGridView 中,您可以在不同大小的框中显示数据,就像您在问题中提供图像一样。
- LinearLayoutManager:用于显示垂直或水平列表。
- GridLayoutManager:用于以网格形式显示项目。
- StaggeredGridLayoutManager:用于在交错网格中显示项目。
您在图片中显示的布局称为 staggered gridview
,为了实现它,您可以找到一个示例 here。
我想创建如图所示的布局, See it my goal
所以我用 LinearLayout 做了,但结果是这样的:
See it
请问我需要您的帮助才能实现我的目标,
你无法用 LinearLayout
实现。
您需要使用 StaggeredGridView 来获得该结果。
对于演示你可以use this
为您的布局使用 Staggered GridView。它会解决您的问题。
StaggeredGridView 类似于 GridView,但在 GridView 中,您可以在相同大小的框中显示数据,而在 StraggeredGridView 中,您可以在不同大小的框中显示数据,就像您在问题中提供图像一样。
- LinearLayoutManager:用于显示垂直或水平列表。
- GridLayoutManager:用于以网格形式显示项目。
- StaggeredGridLayoutManager:用于在交错网格中显示项目。
您在图片中显示的布局称为 staggered gridview
,为了实现它,您可以找到一个示例 here。