如何在表格布局中显示虚线边框
我是android新手,想在表格布局中显示边框。
任何人都可以帮助我,这对我来说非常重要。
I am new in android, want to show border in tablelayout.
can any one please help me, it is very critical for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置
ShapeDrawable
作为您想要边框的元素的背景。您可以在 res/drawables 文件夹中的 XML 文件中定义 ShapeDrawable。特别是,lines
元素具有dashWidth
和dashGaps
参数,可让您制作虚线:您也可以仅设置重复的点图像作为整个表格的背景,然后在单元格上设置纯色背景和边距(请参阅 这个技巧,这是关于实心边框的,但我相信你可以用 2x2 棋盘图案的重复位图)。
Try setting a
ShapeDrawable
as the background of the elements you want a border on. You can define a ShapeDrawable in an XML file in your res/drawables folder. In particular, thestroke
element has thedashWidth
anddashGaps
parameters that let you make a dashed line:You can also just set a repeating dots image as the background of the entire table, then set a solid background and margin on the cells (see this trick, which is written about solid borders but I'm sure you can fake with a 2x2 repeating bitmap of a checkerboard pattern).