3

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.

Mahe
  • 2,707
  • 13
  • 50
  • 69

1 Answers1

1

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.

Vinay S Shenoy
  • 4,028
  • 3
  • 31
  • 36
  • Thanks!! I have only two columns in Gridview. The Spacing of the two columns is more. If I set Background color, the space between two columns fills up with the color and that wont appear as Border. I just want a thin line covering the cell data in gridview. – Mahe Mar 11 '13 at 08:49
  • That's because of the stretchMode for the GridView.. If you set your gridview to use columnWidth stretch mode, your grid items will stretch to fit the screen.. http://developer.android.com/reference/android/widget/GridView.html#attr_android:stretchMode – Vinay S Shenoy Mar 11 '13 at 09:38