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

Android布局之TableLayout表格布局

 更新時(shí)間:2015年12月31日 10:22:32   作者:會(huì)飛的一只狼  
Tablelayout類以行和列的形式對(duì)控件進(jìn)行管理,每一行為一個(gè)TableRow對(duì)象,或一個(gè)View控件。當(dāng)為TableRow對(duì)象時(shí),可在TableRow下添加子控件,默認(rèn)情況下,每個(gè)子控件占據(jù)一列。 當(dāng)為View時(shí),該View將獨(dú)占一行

Tablelayout類以行和列的形式對(duì)控件進(jìn)行管理,每一行為一個(gè)TableRow對(duì)象,或一個(gè)View控件。當(dāng)為TableRow對(duì)象時(shí),可在TableRow下添加子控件,默認(rèn)情況下,每個(gè)子控件占據(jù)一列。 當(dāng)為View時(shí),該View將獨(dú)占一行。

三個(gè)常用的屬性

android:collapseColumns:設(shè)置需要被隱藏的列的序號(hào)

android:shrinkColumns:設(shè)置允許被收縮的列的列序號(hào)

android:stretchColumns:設(shè)置運(yùn)行被拉伸的列的列序號(hào)

學(xué)習(xí)導(dǎo)圖

(1)TableLayout的相關(guān)簡(jiǎn)介

  java的swing編程和html中經(jīng)常會(huì)使用到表格,可見表格的應(yīng)用開發(fā)中使用還是比較多的,同樣android也為我們提供這樣的布局方式。

(2)如何確定行數(shù)

  a:直接向TableLayout組件,直接占一行

  b:如果想在一行添加多個(gè)組件, 就需要使用TableRow中添加

  c:TableRow中有多少個(gè)組件,這一行就會(huì)有多少列

(3)三個(gè)常用屬性(都是從零開始計(jì)數(shù))

  Shrinkable:如果某一列被設(shè)置為Shrinkable,那么該列的所有單元格的寬度可以被收縮,以保證表格能適應(yīng)父容器的寬度;

  Stretchable:如果某一列被設(shè)置為Stretchable,那么該列的所有單元格的寬度可以拉伸,以保證組件完全填充表格空余空間;

  Collapsed:如果某一列被設(shè)置為Collapsed,那么該列的所有單元格的都會(huì)被隱藏;

(4)使用實(shí)例(為了演示效果沒有,所有組件都沒有設(shè)置id)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
  <!--定義第一個(gè)表格布局,指定第二列允許收縮,第三列拉伸-->
  <TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:shrinkColumns="1"
    android:stretchColumns="2">
    <!-- 直接添加組件會(huì)獨(dú)占一行-->
    <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="獨(dú)自占一行"
      />
    <TableRow>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="普通按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="收縮按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸按鈕"/>
    </TableRow>
  </TableLayout>
  <!--定義第二個(gè)表格布局指定第二列隱藏-->
  <TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:collapseColumns="1">
    <!-- 直接添加組件會(huì)獨(dú)占一行-->
    <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="獨(dú)自占一行"
      />
    <TableRow>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="普通按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="普通按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="普通按鈕"/>
    </TableRow>
  </TableLayout>
  <!--定義第三個(gè)表格布局,指定第二列,第三列都可以被拉伸-->
  <TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="1,2">
    <!-- 直接添加組件會(huì)獨(dú)占一行-->
    <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="獨(dú)自占一行"
      />
    <TableRow>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="普通按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸按鈕"/>
      <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸按鈕"/>
    </TableRow>
  </TableLayout>
</LinearLayout>

以上內(nèi)容是小編給大家介紹的android布局之TableLayout表格布局,希望大家喜歡。

相關(guān)文章

  • Android ViewModel的使用總結(jié)

    Android ViewModel的使用總結(jié)

    ViewModel 是 Jetpack 的一部分。 ViewModel 類旨在以注重生命周期的方式存儲(chǔ)和管理界面相關(guān)的數(shù)據(jù)。ViewModel 類讓數(shù)據(jù)可在發(fā)生屏幕旋轉(zhuǎn)等配置更改后繼續(xù)留存。本文簡(jiǎn)單講解ViewModel的使用
    2021-06-06
  • Android酷炫動(dòng)畫效果之3D星體旋轉(zhuǎn)效果

    Android酷炫動(dòng)畫效果之3D星體旋轉(zhuǎn)效果

    本文要實(shí)現(xiàn)的3D星體旋轉(zhuǎn)效果是從CoverFlow演繹而來,不過CoverFlow只是對(duì)圖像進(jìn)行轉(zhuǎn)動(dòng),我這里要實(shí)現(xiàn)的效果是要對(duì)所有的View進(jìn)行類似旋轉(zhuǎn)木馬的轉(zhuǎn)動(dòng)
    2018-05-05
  • Android手勢(shì)密碼實(shí)現(xiàn)實(shí)例代碼

    Android手勢(shì)密碼實(shí)現(xiàn)實(shí)例代碼

    本篇文章主要介紹了Android手勢(shì)密碼實(shí)現(xiàn)實(shí)例代碼,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-04-04
  • Android開發(fā)之串口編程原理和實(shí)現(xiàn)方式

    Android開發(fā)之串口編程原理和實(shí)現(xiàn)方式

    提到串口編程,就不得不提到JNI,不得不提到JavaAPI中的文件描述符類:FileDescriptor;下面我分別對(duì)JNI、FileDescriptor以及串口的一些知識(shí)點(diǎn)和實(shí)現(xiàn)的源碼進(jìn)行分析說明,感興趣的朋友可以了解下
    2013-01-01
  • 利用Warensoft Stock Service編寫高頻交易軟件

    利用Warensoft Stock Service編寫高頻交易軟件

    本文主要介紹了利用Warensoft Stock Service編寫高頻交易軟件的方法步驟,具有一定的參考價(jià)值,下面跟著小編一起來看下吧
    2017-01-01
  • Android組件TabHost實(shí)現(xiàn)頁(yè)面中多個(gè)選項(xiàng)卡切換效果

    Android組件TabHost實(shí)現(xiàn)頁(yè)面中多個(gè)選項(xiàng)卡切換效果

    這篇文章主要為大家詳細(xì)介紹了Android組件TabHost實(shí)現(xiàn)頁(yè)面中多個(gè)選項(xiàng)卡切換效果的相關(guān)資料,感興趣的小伙伴們可以參考一下
    2016-05-05
  • Android實(shí)現(xiàn)圓形圖片效果

    Android實(shí)現(xiàn)圓形圖片效果

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)圓形圖片效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-06-06
  • Android?Framework層獲取及處理按鍵事件流程

    Android?Framework層獲取及處理按鍵事件流程

    本文主要介紹了Android?Framework層獲取及處理按鍵事件流程,Android系統(tǒng)的輸入事件是InputManagerService服務(wù)來監(jiān)控的,該系統(tǒng)服務(wù)在SystemServer的startOtherServices()中初始化,更多介紹需要的小伙伴可以參考一下
    2022-08-08
  • Android高級(jí)圖片滾動(dòng)控件實(shí)現(xiàn)3D版圖片輪播器

    Android高級(jí)圖片滾動(dòng)控件實(shí)現(xiàn)3D版圖片輪播器

    這篇文章主要介紹了Android高級(jí)圖片滾動(dòng)控件實(shí)現(xiàn)3D版圖片輪播器,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-05-05
  • Android TextView仿微信可折疊效果

    Android TextView仿微信可折疊效果

    這篇文章主要為大家詳細(xì)介紹了Android TextView仿微信可折疊效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-12-12

最新評(píng)論

波密县| 遂昌县| 淮北市| 天峨县| 平昌县| 连南| 确山县| 博客| 清远市| 泽州县| 洛川县| 溆浦县| 荆州市| 定结县| 江川县| 霍林郭勒市| 四会市| 阳朔县| 秀山| 五河县| 永州市| 汾阳市| 内丘县| 丹凤县| 丹阳市| 资阳市| 淮滨县| 灵武市| 汾西县| 镇江市| 墨竹工卡县| 湘阴县| 桓台县| 百色市| 唐河县| 休宁县| 金平| 瑞丽市| 海南省| 忻州市| 广州市|