Android GridView with Separator

风流意气都作罢 提交于 2019-12-13 11:34:59

问题


is possible to have a separator between elements of a GridView?

Thanks


回答1:


You'll probably have to play with padding and background colors. Set the background for the table to one color, and the background to each View in the table to another color. Set a 1 or 2 pixel padding around each View in the table, and you should have a border between.




回答2:


from @FreewheelNat's comment, "In your xml for your GridView, use android:horizontalSpacing="1dp" and android:verticalSpacing="1dp" to set a 1 (density independent) pixel padding around each cell for example. "

this is a much better solution than @Jeff Barger's



来源:https://stackoverflow.com/questions/2382736/android-gridview-with-separator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!