How to set Gridlines to a GridView in Android

Mahe picture Mahe · Mar 11, 2013 · Viewed 7.8k times · Source

I am using GridView to show a summary report of 3 columns in my app. EveryThing seems to work fine except the GridLines for Gridview is missing.

Can anyone please suggest how to display GridLines for GridView and even Headers.

Thanks.

Answer

Vinay S Shenoy picture Vinay S Shenoy · Mar 11, 2013

I actually have a much simpler solution.

What you can do is that set the vertical and horizontal spacing for your Gridview to, say 1dp or 2dp depending on how thick you want the border to be. Then just set the background color of your GridView to the color you need for your borders.

Let me know if this works for you.