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程序設(shè)計有所幫助。
- 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)文章
點擊微信內(nèi)網(wǎng)頁a標簽直接跳轉(zhuǎn)打開淘寶APP的方法實例
這篇文章主要給大家介紹了關(guān)于如何實現(xiàn)點擊微信內(nèi)網(wǎng)頁a標簽直接跳轉(zhuǎn)打開淘寶APP的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。2017-11-11
Android中點擊按鈕啟動另一個Activity及Activity之間傳值問題
這篇文章主要介紹了Android中點擊按鈕啟動另一個Activity及Activity之間傳值問題,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2020-01-01
Android控件系列之Button以及Android監(jiān)聽器使用介紹
Button是各種UI中最常用的控件之一,它同樣也是Android開發(fā)中最受歡迎的控件之一,用戶可以通過觸摸它來觸發(fā)一系列事件,要知道一個沒有點擊事件的Button是沒有任何意義的,因為使用者的固定思維是見到它就想去點2012-11-11
android播放視頻時在立體聲與單聲道之間切換無變化原因分析及解決
使用第三方視頻播放器,有立體聲與單聲道之間切換,發(fā)現(xiàn)切換后無作用,原因是由于在HAL層默認沒有處理上層發(fā)的stereo 轉(zhuǎn)mono的命令,具體的解決方法如下2013-06-06
android中Intent傳值與Bundle傳值的區(qū)別詳解
本篇文章是對android中Intent傳值與Bundle傳值的區(qū)別進行了詳細的分析介紹,需要的朋友參考下2013-05-05

