欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

這里寫(xiě)圖片描述

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

這里寫(xiě)圖片描述

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

相關(guān)文章

  • 淺析Android 快速實(shí)現(xiàn)圖片壓縮與上傳功能

    淺析Android 快速實(shí)現(xiàn)圖片壓縮與上傳功能

    在Android對(duì)手機(jī)相冊(cè)中的圖片的壓縮和上傳到服務(wù)器上,這樣的功能在每個(gè)app開(kāi)發(fā)中都會(huì)有這樣的需求.所以今天就對(duì)android端怎么快速實(shí)現(xiàn)圖片壓縮和上傳進(jìn)行簡(jiǎn)單的分析
    2017-08-08
  • Flutter定義tabbar底部導(dǎo)航路由跳轉(zhuǎn)的方法

    Flutter定義tabbar底部導(dǎo)航路由跳轉(zhuǎn)的方法

    這篇文章主要為大家詳細(xì)介紹了Flutter定義tabbar底部導(dǎo)航路由跳轉(zhuǎn)的方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • Android開(kāi)發(fā)中類(lèi)加載器DexClassLoader的簡(jiǎn)單使用講解

    Android開(kāi)發(fā)中類(lèi)加載器DexClassLoader的簡(jiǎn)單使用講解

    這篇文章主要介紹了Android開(kāi)發(fā)中類(lèi)加載器DexClassLoader的簡(jiǎn)單使用講解,DexClassLoader可以看作是一個(gè)特殊的Java中的ClassLoader,需要的朋友可以參考下
    2016-04-04
  • 分析CmProcess跨進(jìn)程通信的實(shí)現(xiàn)

    分析CmProcess跨進(jìn)程通信的實(shí)現(xiàn)

    CmProcess是Android一個(gè)跨進(jìn)程通信框架,無(wú)需進(jìn)行bindService()操作,不用定義Service,也不需要定義aidl。 支持IPC級(jí)的 Callback,并且支持跨進(jìn)程的事件總線,可同步獲取服務(wù),采用面向接口方式進(jìn)行服務(wù)注冊(cè)與調(diào)用,服務(wù)調(diào)用方和使用者完全解耦
    2021-06-06
  • android gradle如何修改生成的apk名字

    android gradle如何修改生成的apk名字

    Gradle是當(dāng)前非常“勁爆”得構(gòu)建工具,而這篇文章主要給大家介紹了關(guān)于android gradle如何修改生成的apk名字的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-12-12
  • Android?WebView開(kāi)發(fā)之自定義WebView工具框

    Android?WebView開(kāi)發(fā)之自定義WebView工具框

    在WebView頁(yè)面長(zhǎng)按時(shí)會(huì)彈出一個(gè)復(fù)制框,有的時(shí)候里面的item不是我們想要,這個(gè)時(shí)候我們就可以自定義一個(gè)工具框。本文就將介紹如何通過(guò)WebView自定義工具框,需要的朋友可以參考一下
    2021-12-12
  • Android開(kāi)發(fā)仿咸魚(yú)鍵盤(pán)DEMO(修改版)

    Android開(kāi)發(fā)仿咸魚(yú)鍵盤(pán)DEMO(修改版)

    本文給大家分享一段代碼關(guān)于android開(kāi)發(fā)高仿咸魚(yú)鍵盤(pán)修改版的實(shí)例代碼,代碼簡(jiǎn)單易懂,非常實(shí)用,需要的朋友參考下吧
    2016-11-11
  • Android項(xiàng)目中實(shí)體類(lèi)entity的作用詳解

    Android項(xiàng)目中實(shí)體類(lèi)entity的作用詳解

    這篇文章主要介紹了Android項(xiàng)目中實(shí)體類(lèi)entity的作用詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-04-04
  • Android 7.0系統(tǒng)webview 顯示https頁(yè)面空白處理方法

    Android 7.0系統(tǒng)webview 顯示https頁(yè)面空白處理方法

    今天小編就為大家分享一篇Android 7.0系統(tǒng)webview 顯示https頁(yè)面空白處理方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-07-07
  • Android開(kāi)發(fā)實(shí)現(xiàn)圖片圓角的方法

    Android開(kāi)發(fā)實(shí)現(xiàn)圖片圓角的方法

    這篇文章主要介紹了Android開(kāi)發(fā)實(shí)現(xiàn)圖片圓角的方法,涉及Android針對(duì)圖形圖像的相關(guān)操作技巧,需要的朋友可以參考下
    2016-10-10

最新評(píng)論