国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - Android - Android開發(fā)之TableLayout表格布局

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

2021-07-24 22:16許佳佳233 Android

這篇文章主要為大家詳細介紹了Android開發(fā)之TableLayout表格布局,表格布局模型是以行列的形式管理子控件,對TableLayout表格布局感興趣的小伙伴們可以參考一下

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

tablelayout屬性:

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

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

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

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

android:layout_colum:設置該控件在tablerow中指定的列。

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

圖片:

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

代碼:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<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軟件編程有所幫助。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产日韩视频在线观看 | 久久一区二区视频 | 伊人久久综合 | 日本在线免费观看视频 | 欧美专区在线 | 免费成人在线观看 | 日韩在线观看中文字幕 | 国产免费av在线 | 蜜桃免费一区二区三区 | 色av影院| 成人午夜 | 在线毛片观看 | 亚洲一区电影 | 日韩欧美一区二区三区 | 精品久久久久久久久久久 | 欧美日韩不卡 | 国产中文字幕一区 | 成人免费一区二区三区视频网站 | 欧美伦理一区二区 | 六月婷操| 久久不射电影网 | 午夜影院免费 | 玖玖久久 | 毛片区 | 中文字幕在线观看视频地址二 | 久草成人网 | 狠狠爱天天操 | 亚洲v在线| 国产精品久久久久久久久 | 国内精品视频一区二区三区八戒 | 中文字幕在线观看视频地址二 | 欧美视频在线观看 | 在线小视频国产 | 久久精品1区 | 欧美一级片免费在线观看 | 日韩在线观看中文字幕 | 中文字幕精品一区 | a级片在线观看 | 亚洲国产aⅴ成人精品无吗 久久综合久久久 | 日韩中文在线视频 | 欧美不卡在线 |