Grid-lines On A Gridview
How do I define grid-lines for a GridView? Is there an attribute or do I have to draw my own background with them in it?
Solution 1:
There is no such attribute. The easiest thing is to create a subclass of GridView and overridedispatchDraw()
or onDraw()
to do it yourself.
Solution 2:
set the background to the view(inflate layout) inside the GridView so that gridview display the line automatically.
Solution 3:
You can just set a padding for each cell of the grid view so that that looks like the grid line. Each cell say would be made up of a linear layout.
Another way of doing this would be to have the cell as a linearlayout and have a view inside that with width of say 0.5dp and height as mp and vice-versa for the horizontal line.
Post a Comment for "Grid-lines On A Gridview"