简体   繁体   中英

Specifying margin between each child element of a gridview by column [ANDROID]

Given this scenario : image

I'm trying to position every child elements of the gridview such that it will have specific margin value with the gridview child element that is directly above the element, and I would like the margin value (the vertical spacing between each child) to be consistent in relation to the Gridview child element directly above it.

From the context of the image uploaded above, I want to minimize the spacing between each child elements vertically given the case that each Gridview element's height is variable and I intend to keep it this way. I'm also using a custom adapter to supply the items for the GridView. Is there any method/XML attribute in a GridView class I can use to perform this task or do I need to use a custom view and override from GridView to implement this feature? Thanks in advance.

显然,GridView不支持这种实现,因此我不得不诉诸于StaggeredGridLayoutManager

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM