Tablelayouyt layout is difficult to control the border,
First take a look at the following picture
There is no boder attribute in tablelayout, which is quite tangled. I don't know what Google thinks, but I don't need to talk about the border mechanism.
Tablelayout border layout: in fact, the background color is set to the background color. The overlapping part is the border we want.
<Tablerow
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: Background = "@ color/gray"> <! -- Here we set the background color of tablerow, and the view is loaded in tablerow -->
<Textview
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: Background = "@ color/White" <! -- When setting the background color for loading the view, it is important to add the Android: layout_margin attribute to make the view and row have a distance, so that the border will come out. -->
Android: gravity = "center"
Android: layout_margin = "1dp"
Android: text = "date"/>
This is a method, but you will seriously find that the split line in the middle is thicker than the top and bottom lines on both sides, because Android is added to each textview: layout_margin = "1dp", margin is 1 for both the left and right sides, and overlap between the left and right sides of the second table, if you want to adjust the value, you can set the upper, lower, and lower sides of margin in detail,
In fact, it is not obvious that you set the line details.
Another method is to customize the background of the table view. By using the shape. xml file, we only need to reference it in the view. This method is simple. We recommend that you use this method later.
<Shape xmlns: Android = "http://schemas.android.com/apk/res/android">
<! -- Fill color -->
<Gradient
Android: angle = "0"
Android: endcolor = "# ffffff"
Android: startcolor = "# ffffff"/>
<! -- Radians of the four corners -->
<Stroke
Android: width = "0.5dp"
Android: color = "# dbdbdb"/>
<! -- Angle -->
<Corners Android: radius = "3dp"/>
<Padding
Android: Bottom = "5dp"
Android: Left = "5dp"
Android: Right = "5dp"
Android: Top = "5dp"/>
</Shape>
The above is a simple application of the border. To make a good display, You need to carefully deploy it, but it is OK to know how to implement it.