开发者

Grid-lines on a GridView

开发者 https://www.devze.com 2023-03-06 13:54 出处:网络
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 subc

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

精彩评论

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

关注公众号