The Android table layout itself has no border, but the background color can be used to display the table borders.
You can first set the background color of the TableRow, and then set the back color of the content. A border appears based on their color difference. Just fine-tune the margin and pading properties of content with TableRow!
The process of tuning is really annoying! Next time don't do this kind of work ~ whining! Uncomfortable!
Paste the Layout code:
<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:background= "@color/white" > <includeLayout= "@layout/titlebar_home" /> <TablelayoutAndroid:id= "@+id/table1"Android:layout_width= "Fill_parent"Android:layout_height= "Wrap_content"Android:layout_margintop= "50DP"android:padding= "6.5dip" > <TableRowAndroid:background= "@color/jiemianbiankuang"android:orientation= "Horizontal"Android:paddingleft= "0.5dip"Android:paddingright= "0.5dip"Android:paddingtop= "1dip" > <ImageButtonAndroid:id= "@+id/imageviewmsg"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:contentdescription= "@string/messagecenter"android:src= "@drawable/msg" /> <ImageButtonAndroid:id= "@+id/imageview1"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:src= "@drawable/book" /> <ImageButtonAndroid:id= "@+id/imageview2"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:src= "@drawable/maozi" /> </TableRow> <TableRowAndroid:background= "@color/jiemianbiankuang"android:orientation= "Horizontal"Android:paddingleft= "0.5dip"Android:paddingright= "0.5dip"Android:paddingtop= "0dip" > <ImageButtonAndroid:id= "@+id/imageview4"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:src= "@drawable/earth" /> <ImageButtonAndroid:id= "@+id/imageview5"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:src= "@drawable/unno" /> <ImageButtonAndroid:id= "@+id/imageview6"Android:layout_width= "100DP"Android:layout_height= "100DP"android:layout_gravity= "Center_vertical"Android:layout_marginbottom= "0.5dip"Android:layout_marginleft= "0.5dip"Android:background= "@color/white"android:src= "@drawable/zuoye" /> </TableRow> </Tablelayout></Relativelayout>