最新国产好看的视频,伊人天堂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)論

抚顺市| 尚志市| 平武县| 喜德县| 白城市| 简阳市| 清原| 蒙城县| 兴文县| 满洲里市| 堆龙德庆县| 齐齐哈尔市| 大埔县| 平昌县| 鹤山市| 祁阳县| 鹤峰县| 山阳县| 华亭县| 澎湖县| 北宁市| 乌鲁木齐市| 凤城市| 嘉峪关市| 抚顺县| 金平| 湟中县| 宣汉县| 南平市| 东港市| 达孜县| 嵩明县| 睢宁县| 五峰| 韶关市| 南平市| 鹤岗市| 靖州| 庐江县| 汉阴县| 五河县|