国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android布局之表格布局TableLayout詳解

2019-12-12 01:55:00
字體:
來源:轉載
供稿:網友

本文實例為大家分享了Android表格布局TableLayout的具體代碼,供大家參考,具體內容如下

1.TableLayout

TableLayout表格布局模型以行列的形式管理子控件,每一行為一個TableRow的對象, 當然也可以使一個View的對象

2.TableLayout的屬性(全局屬性)

android:collapseColumns=”1,2”
隱藏從0開始的索引列,列之間必須用逗號隔開1,2
android:shrinkColumns=”1,2”
收縮從0開始的索引列,當可收縮的列太寬(內容太多時)不會被擠出屏幕,列之間
用逗號隔開1,2,你可以通過”*”代替收縮所有列,注意一列能同時表示收縮和拉伸
android:stretchColumns=”1,2”
拉伸從0開始的索引列,以填滿剩下的多余空白空間,列之間必須用逗號隔開,1,2,
你可以通過”*”代替收縮所有列,注意一列能同時表示收縮和拉伸

3.TableLayout的局部屬性(內部控件所用屬性)

android:layout_column=”1” 該控件顯示在第1列
android:layout_span=”2” 該控件占據兩列

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:collapseColumns="0" android:shrinkColumns="4"> <TableRow  android:id="@+id/tablerow1"  android:layout_width="wrap_content"  android:layout_height="wrap_content" >  <Button   android:id="@+id/button4"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button1" />  <Button   android:id="@+id/button5"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button2" />  <Button   android:id="@+id/button6"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button3" />  <Button   android:id="@+id/button7"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button4" />  <Button   android:id="@+id/button8"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button555555555555555555555555" /> </TableRow></TableLayout>

這里寫圖片描述

<?xml version="1.0" encoding="utf-8"?><TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="*"> <TableRow  android:id="@+id/tablerow1"  android:layout_width="match_parent"  android:layout_height="match_parent">  <Button   android:id="@+id/button4"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button1" />  <Button   android:id="@+id/button5"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button2" />  <Button   android:id="@+id/button6"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="Button3" /> </TableRow></TableLayout>

這里寫圖片描述

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平果县| 武夷山市| 霍城县| 澜沧| 诸城市| 雅安市| 保亭| 永吉县| 西贡区| 红原县| 五原县| 星座| 调兵山市| 桂平市| 白玉县| 会理县| 宾川县| 洛扎县| 马山县| 通城县| 莆田市| 岚皋县| 永城市| 沙田区| 玉龙| 苏尼特左旗| 瑞丽市| 岳普湖县| 安化县| 大姚县| 榆林市| 灵武市| 青河县| 汝阳县| 梁河县| 广西| 永嘉县| 浪卡子县| 惠来县| 合阳县| 丰台区|