Android的gridview的行分隔/分离器分离器、Android、gridview

2023-09-12 11:18:23 作者:君子傲つ

有没有一种方法,以显示行之间的(水平)分隔在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:

http://stackoverflow.com/a/9757501/1310343

使用背景图像这正是高达在我的GridView一个项目,并具有devider在底部。

using a background image that is exactly as high as one item in my gridview, and has a devider at the bottom.

工程就像一个魅力!