The example in this article describes how Android implements a border-drawing method for tablelayou. Share to everyone for your reference, specific as follows:
The effect is as follows:
idea : Use share as background display border
Steps :
1. Create table_frame_gray.xml files under the Res/drawable folder:
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android "
android:shape=" Rectangle >
<solid android:color= "#ffffff"/>
<stroke
Android:width= "0.01DP"
android:color= "#848484"/>
</shape>
2. Refer to the Table_frame_gray.xml file as the background in the layout file:
<relativelayout xmlns: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= "#FFFF00" android:paddingbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/ Activity_horizontal_margin "android:paddingright=" @dimen/activity_horizontal_margin "android:paddingtop=" @dimen Activity_vertical_margin "tools:context=".
Mainactivity "> <tablelayout android:layout_width=" wrap_content "android:layout_height=" Wrap_content " Android:background= "#FF4000" android:stretchcolumns= "*" android:text= "@string/hello_world" > <!--micro-blog number > <TableRow> <linearlayout android:layout_width= "Wrap_content" android:layout_height
= "Wrap_content" android:background= "@drawable/table_frame_gray" android:orientation= "vertical" > <textview andRoid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:padding= "5DP" android:text= "232"/> <textview android:layout_width= "Wrap_content" Android:layout_heigh t= "Wrap_content" android:padding= "5DP" android:text= "Weibo"/> </LinearLayout> <! --Concern number--> <linearlayout android:layout_width= "wrap_content" android:layout_height= "Wrap_cont" Ent "android:background=" @drawable/table_frame_gray "android:orientation=" vertical "> <textv Iew android:layout_width= "wrap_content" android:layout_height= "Wrap_content" android:padding = "5DP" android:text= "/>" <textview android:layout_width= "Wrap_content" Andr oid:layout_height= "Wrap_content" android:padding= "5DP" android:text= "Attention"/> </linearlayout > <!--friends number--> <linearlayout android:layout_width= "wrap_content" android:layout_height= "Wrap_content"
android:background= "@drawable/table_frame_gray" android:orientation= "vertical" > <textview
Android:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:padding= "5DP" android:text= "9"/> <textview android:layout_width= "Wrap_content" android:layout _height= "Wrap_content" android:padding= "5DP" android:text= "Fan"/> </LinearLayout> &
Lt;/tablerow> </TableLayout> </RelativeLayout>
For more information on Android-related content readers can view the site topics: "Android Debugging techniques and common problems solution summary", "Android Development introduction and Advanced Course", "Android Multimedia operating skills Summary (audio, video, recording, etc.)", " Android Basic Components Usage Summary, Android View tips Summary, Android layout layout tips and Android Control usage summary
I hope this article will help you with the Android program.