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

Android開發(fā)之TableLayout表格布局

 更新時間:2016年03月25日 15:29:16   作者:許佳佳233  
這篇文章主要為大家詳細介紹了Android開發(fā)之TableLayout表格布局,表格布局模型是以行列的形式管理子控件,對TableLayout表格布局感興趣的小伙伴們可以參考一下

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

TableLayout屬性:

android:collapseColumns:將TableLayout里面指定的列隱藏,若有多列需要隱藏,請用逗號將需要隱藏的列序號隔開。            

android:stretchColumns:設(shè)置指定的列為可伸展的列,以填滿剩下的多余空白空間,若有多列需要設(shè)置為可伸展,請用逗號將需要伸展的列序號隔開。               

android:shrinkColumns:設(shè)置指定的列為可收縮的列。當可收縮的列太寬(內(nèi)容過多)不會被擠出屏幕。當需要設(shè)置多列為可收縮時,將列序號用逗號隔開。

 列元素(Button)屬性:(奇怪的是button 里面沒有android:layout_column 和android:layout_span兩個屬性,寫進去無反應(yīng),還不知道為什么)

android:layout_colum:設(shè)置該控件在TableRow中指定的列。

android:layout_span:設(shè)置該控件所跨越的列數(shù)。

圖片:

代碼:

  <LinearLayout 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:orientation="vertical"
    tools:context=".AndroidTableLayoutActivity" >
  
    <!-- 定義第一個表格,指定第2列允許收縮,第3列允許拉伸 -->
  
   <TableLayout
     android:id="@+id/tablelayout01"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:shrinkColumns="1"
     android:stretchColumns="2" >
 
     <!-- 直接添加按鈕,自己占用一行 -->
 
     <Button
       android:id="@+id/btn01"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="獨自一行" >
     </Button>
 
     <TableRow>
 
       <Button
         android:id="@+id/btn02"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="普通" >
       </Button>
 
       <Button
         android:id="@+id/btn03"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="允許被收縮允許被收縮允許被收縮允許被收縮" >
       </Button>
 
       <Button
         android:id="@+id/btn04"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="允許被拉伸" >
       </Button>
     </TableRow>
   </TableLayout>
   <!-- 定義第2個表格,指定第2列隱藏 -->
 
   <TableLayout
     android:id="@+id/tablelayout02"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:collapseColumns="1" >
 
     <TableRow>
 
       <Button
         android:id="@+id/btn05"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="普通" >
       </Button>
 
       <Button
         android:id="@+id/btn06"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="被隱藏列" >
       </Button>
 
       <Button
         android:id="@+id/btn07"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="允許被拉伸" >
       </Button>
    </TableRow>
   </TableLayout>
   <!-- 定義第3個表格,指定第2列填滿空白-->
 
   <TableLayout
     android:id="@+id/tablelayout03"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:stretchColumns="1"
      >
 
     <TableRow>
 
       <Button
         android:id="@+id/btn08"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="普通" >
      </Button>
 
       <Button
         android:id="@+id/btn09"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
        android:text="填滿剩余空白" >
      </Button>
     </TableRow>
   </TableLayout>
  <!-- 定義第3個表格,指定第2列橫跨2列-->
 
   <TableLayout
     android:id="@+id/tablelayout04"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     >
 
     <TableRow>
 
      <Button
         android:id="@+id/btn10"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="普通" >
       </Button>
       
       <Button
         android:id="@+id/btn11"
        android:layout_column="2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="填滿剩余空白" >
       </Button>
    </TableRow>
   </TableLayout>
 </LinearLayout>

希望本文所述對大家學習Android軟件編程有所幫助。

相關(guān)文章

  • Android實現(xiàn)點贊動畫(27)

    Android實現(xiàn)點贊動畫(27)

    這篇文章主要為大家詳細介紹了Android實現(xiàn)點贊動畫,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • Android實現(xiàn)APP環(huán)境分離(利用Gradle)

    Android實現(xiàn)APP環(huán)境分離(利用Gradle)

    有過互聯(lián)網(wǎng)軟件開發(fā)經(jīng)驗的朋友一定對于測試環(huán)境和生產(chǎn)環(huán)境這兩個詞很是熟悉,在開發(fā)和測試階段,我們常常需要在同一個設(shè)備上同時安裝著兩套甚至多套環(huán)境的同一個應(yīng)用,便于觀察調(diào)試。所以這篇文章就來和大家分享Android利用Gradle實現(xiàn)APP環(huán)境分離的方法。
    2016-09-09
  • android 設(shè)置wallpaper的操作方法

    android 設(shè)置wallpaper的操作方法

    下面小編就為大家?guī)硪黄猘ndroid 設(shè)置wallpaper的操作方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • 基于Flutter實現(xiàn)按位置大小比例布局的控件

    基于Flutter實現(xiàn)按位置大小比例布局的控件

    做視頻監(jiān)控項目時需要需要展示多分屏,比如2x2、3x3、414等等,所以本文為大家介紹了如何基于Flutter實現(xiàn)按位置大小比例布局的控件,需要的可以參考一下
    2023-08-08
  • Android ListView 和ScroolView 出現(xiàn)onmeasure空指針的解決辦法

    Android ListView 和ScroolView 出現(xiàn)onmeasure空指針的解決辦法

    這篇文章主要介紹了Android ListView 和ScroolView 出現(xiàn)onmeasure空指針的解決辦法的相關(guān)資料,需要的朋友可以參考下
    2017-02-02
  • Android APK使用Debug簽名重新打包 Eclipse更改默認Debug簽名

    Android APK使用Debug簽名重新打包 Eclipse更改默認Debug簽名

    這篇文章主要介紹了Android APK使用Debug簽名重新打包 Eclipse更改默認Debug簽名等內(nèi)容,需要的朋友可以參考下
    2015-04-04
  • Android 用 camera2 API 自定義相機

    Android 用 camera2 API 自定義相機

    本文主要介紹了Android 用 camera2 API 自定義相機的相關(guān)知識。具有很好的參考價值。下面跟著小編一起來看下吧
    2017-04-04
  • Android手機拍照或選取圖庫圖片作為頭像

    Android手機拍照或選取圖庫圖片作為頭像

    這篇文章主要介紹了Android手機拍照或選取圖庫圖片作為頭像的相關(guān)資料,需要的朋友可以參考下
    2015-06-06
  • android控制密碼顯示與隱藏的方法

    android控制密碼顯示與隱藏的方法

    這篇文章主要為大家詳細介紹了android控制密碼顯示與隱藏的方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-08-08
  • android實現(xiàn)數(shù)獨游戲機器人

    android實現(xiàn)數(shù)獨游戲機器人

    這篇文章主要為大家詳細介紹了android實現(xiàn)數(shù)獨游戲機器人,文中安裝步驟介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-03-03

最新評論

左权县| 库尔勒市| 洪泽县| 龙泉市| 黎川县| 文成县| 阜平县| 明光市| 林芝县| 永登县| 龙岩市| 杭锦旗| 会同县| 舒兰市| 宾阳县| 克拉玛依市| 平阳县| 隆子县| 灯塔市| 五大连池市| 兴安县| 五指山市| 昭苏县| 呼和浩特市| 巴青县| 贺州市| 中阳县| 克什克腾旗| 安溪县| 武邑县| 彰武县| 斗六市| 蒙自县| 新兴县| 德州市| 陇川县| 诏安县| 金昌市| 林口县| 永胜县| 淳安县|