开发者

Grid-lines on a GridView

H开发者_运维问答ow 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?


There is no such attribute. The easiest thing is to create a subclass of GridView and override dispatchDraw() or onDraw() to do it yourself.


set the background to the view(inflate layout) inside the GridView so that gridview display the line automatically.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜