Android實現(xiàn)給TableLayou繪制邊框的方法
本文實例講述了Android實現(xiàn)給TableLayou繪制邊框的方法。分享給大家供大家參考,具體如下:
效果如下:

思路:使用share作為背景顯示邊框
步驟:
1.在res/drawable文件夾下建立table_frame_gray.xml文件:
<?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.在布局文件里引用table_frame_gray.xml文件作為背景:
<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" >
<!-- 微博數(shù) -->
<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_height="wrap_content"
android:padding="5dp"
android:text="微博" />
</LinearLayout>
<!-- 關(guān)注人數(shù) -->
<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="38" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="關(guān)注" />
</LinearLayout>
<!-- 好友數(shù) -->
<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="粉絲" />
</LinearLayout>
</TableRow>
</TableLayout>
</RelativeLayout>
更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android調(diào)試技巧與常見問題解決方法匯總》、《Android開發(fā)入門與進階教程》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)》
希望本文所述對大家Android程序設計有所幫助。
- Android拋物線下載動畫制作過程
- Android編程實現(xiàn)ImageView圖片拋物線動畫效果的方法
- Android使用音頻信息繪制動態(tài)波紋
- Android編程繪制圓形圖片的方法
- Android自定義View之繼承TextView繪制背景
- Android編程之canvas繪制各種圖形(點,直線,弧,圓,橢圓,文字,矩形,多邊形,曲線,圓角矩形)
- Android使用Canvas繪制圓形進度條效果
- Android使用自定義View繪制漸隱漸現(xiàn)動畫
- Android Path繪制貝塞爾曲線實現(xiàn)QQ拖拽泡泡
- Android自定義控件繪制基本圖形基礎(chǔ)入門
- Android編程繪制拋物線的方法示例
相關(guān)文章
Android自定義ViewPager實現(xiàn)縱向滑動翻頁效果
這篇文章主要為大家詳細介紹了Android自定義ViewPager實現(xiàn)縱向滑動翻頁效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-07-07
Android編程動態(tài)加載布局實例詳解【附demo源碼】
這篇文章主要介紹了Android編程動態(tài)加載布局,結(jié)合實例形式分析了Android動態(tài)加載布局的原理、操作步驟與相關(guān)實現(xiàn)技巧,需要的朋友可以參考下2016-10-10
Android手機注冊登錄時獲取驗證碼之后倒計時功能(知識點總結(jié))
這篇文章主要介紹了Android手機注冊登錄時獲取驗證碼之后倒計時(知識點總結(jié))功能,代碼簡單易懂,非常不錯,具有參考借鑒價值,需要的的朋友參考下吧2017-01-01

