android gridview行分隔符/分隔符 [英] android gridview row dividers / separators
问题描述
有没有办法在 gridview 中显示行之间的(水平)分隔线?
Is there a way to show (horizontal) dividers between rows in a gridview?
我尝试在每个网格项下方放置一个小的分隔符图像,但这不是解决方案,因为当一行未完全填满项目时,它不会跨越整行.
I tried putting a small divider-image below every grid item, but this is not a solution, because it won't span the whole row when a row is not completely filled with items.
有没有办法只在每一行之间添加一个图像?我只能找到改变行间距的方法.
Is there a way to just add an image between every row? I can only find methods for changing the space between rows.
推荐答案
我最终创建了一个自定义的 gridview,如下所示:
I ended up creating a custom gridview, something like this:
https://stackoverflow.com/a/9757501/1310343
使用与我的网格视图中的一个项目完全一样高的背景图像,并且底部有一个分隔符.
using a background image that is exactly as high as one item in my gridview, and has a devider at the bottom.
就像一个魅力!
这篇关于android gridview行分隔符/分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!