最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android布局之表格布局TableLayout詳解

 更新時(shí)間:2017年10月12日 09:17:14   作者:海向_起源  
這篇文章主要為大家詳細(xì)介紹了Android布局之表格布局TableLayout,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

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

1.TableLayout

TableLayout表格布局模型以行列的形式管理子控件,每一行為一個(gè)TableRow的對(duì)象, 當(dāng)然也可以使一個(gè)View的對(duì)象

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

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

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

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

<?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>

這里寫圖片描述

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

通渭县| 宜阳县| 内黄县| 策勒县| 桦南县| 贺州市| 六枝特区| 江油市| 都兰县| 临城县| 东乌珠穆沁旗| 吉安市| 民县| 武鸣县| 蒙山县| 永仁县| 自治县| 威信县| 白玉县| 汉源县| 临高县| 新巴尔虎右旗| 泰和县| 新宾| 巴青县| 巴南区| 襄城县| 磐石市| 宣化县| 伽师县| 四会市| 崇左市| 东城区| 个旧市| 津南区| 新安县| 丹巴县| 大港区| 资源县| 惠水县| 旌德县|