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

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

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

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

TableLayout屬性:

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

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

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

 列元素(Button)屬性:(奇怪的是button 里面沒有android:layout_column 和android:layout_span兩個(gè)屬性,寫進(jìn)去無反應(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" >
  
    <!-- 定義第一個(gè)表格,指定第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="獨(dú)自一行" >
     </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個(gè)表格,指定第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個(gè)表格,指定第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個(gè)表格,指定第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>

希望本文所述對大家學(xué)習(xí)Android軟件編程有所幫助。

相關(guān)文章

  • Android自定義控件之仿優(yōu)酷菜單

    Android自定義控件之仿優(yōu)酷菜單

    這篇文章主要為大家詳細(xì)介紹了Android自定義控件之仿優(yōu)酷菜單的相關(guān)資料,感興趣的小伙伴們可以參考一下
    2016-06-06
  • Android自定義attr的各種坑

    Android自定義attr的各種坑

    開發(fā)過程中經(jīng)常會(huì)自定義View來實(shí)現(xiàn)各種各樣炫酷的效果,在實(shí)現(xiàn)這些效果的同時(shí),我們往往會(huì)定義很多attr屬性這篇文章主要介紹了Android自定義attr的各種坑,需要的朋友可以參考下
    2016-04-04
  • Android自定義對話框Dialog

    Android自定義對話框Dialog

    這篇文章主要為大家詳細(xì)介紹了Android自定義對話框Dialog的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • Android Studio中的Gradle依賴深入講解

    Android Studio中的Gradle依賴深入講解

    Android Studio由于使用了gradle的進(jìn)行項(xiàng)目構(gòu)建,使我們開發(fā)app方便很多,下面這篇文章主要給大家介紹了關(guān)于Android Studio中Gradle依賴的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2018-09-09
  • Android加載loading對話框的功能及實(shí)例代碼(不退出沉浸式效果)

    Android加載loading對話框的功能及實(shí)例代碼(不退出沉浸式效果)

    這篇文章主要介紹了Android加載loading對話框的功能及實(shí)例代碼,不退出沉浸式效果,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-12-12
  • Android協(xié)程的7個(gè)重要知識(shí)點(diǎn)匯總

    Android協(xié)程的7個(gè)重要知識(shí)點(diǎn)匯總

    在現(xiàn)代Android應(yīng)用開發(fā)中,協(xié)程(Coroutine)已經(jīng)成為一種不可或缺的技術(shù),它不僅簡化了異步編程,還提供了許多強(qiáng)大的工具和功能,可以在高階場景中發(fā)揮出色的表現(xiàn),本文將深入探討Coroutine重要知識(shí)點(diǎn),幫助開發(fā)者更好地利用Coroutine來構(gòu)建高效的Android應(yīng)用
    2023-09-09
  • 基于Flutter實(shí)現(xiàn)多邊形和多角星組件

    基于Flutter實(shí)現(xiàn)多邊形和多角星組件

    開發(fā)中,免不了會(huì)用到多邊形、多角星等圖案,比較常用的多邊形比如雷達(dá)圖、多角星比如評(píng)價(jià)星級(jí)的五角星等,本文章就使用Flutter繪制封裝一個(gè)這樣的組件,需要的可以參考一下
    2022-05-05
  • 基于Flutter實(shí)現(xiàn)手勢密碼加密與解鎖功能

    基于Flutter實(shí)現(xiàn)手勢密碼加密與解鎖功能

    這篇文章主要介紹了如何利用Flutter實(shí)現(xiàn)手勢密碼的加密與解鎖,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • flutter底部彈出BottomSheet詳解

    flutter底部彈出BottomSheet詳解

    這篇文章主要為大家詳細(xì)介紹了flutter底部彈出BottomSheet,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • Android側(cè)滑菜單之DrawerLayout用法詳解

    Android側(cè)滑菜單之DrawerLayout用法詳解

    今天小編就為大家分享一篇關(guān)于Android側(cè)滑菜單之DrawerLayout用法詳解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2019-03-03

最新評(píng)論