Android里的表格布局與HTML中的表格標(biāo)簽< table >< tr >< td >類似,根據(jù)使用表格的行與列來(lái)排序部件。假如一行上有好幾個(gè)部件得話,也要在TableLayout中加入一個(gè)TableRow的器皿,把部件都丟到里邊!一個(gè)Tablerow一行,有多少個(gè)列乃是看TableRow里的部件數(shù)量。
常見(jiàn)特性
android:collapseColumns:掩藏某一列
android:shrinkColumns:容許某一列收攏
android:stretchColumns:拉申某一列
這三個(gè)的屬性列號(hào)也是從0算起的,如shrinkColunmns = “3”,對(duì)應(yīng)著第四列,能設(shè)好幾個(gè),用分號(hào)分隔例如”0,3″,假如是全部列都起效,用”*”號(hào)就可以。
android:layout_column=”3″:表述的便是繞過(guò)第三個(gè),立即表明到第四個(gè)方格處,從1算起。
android:layout_span=”2″:表明合拼2個(gè)表格中,也就說(shuō)這一部件占2個(gè)表格中。
看代碼
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:stretchColumns="2"
android:shrinkColumns="1">
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@ id/button7"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button1" />
android:id="@ id/button6"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button2" />
android:id="@ id/button4"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button3" />
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@ id/button9"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button4" />
android:id="@ id/button8"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button5" />
android:id="@ id/button5"
android:layout_width="139dp"
android:layout_height="117dp"
android:text="Button6" />
設(shè)計(jì)效果圖

幀布局是比較簡(jiǎn)單一種布局,該布局為每一個(gè)加入進(jìn)來(lái)的控制創(chuàng)建一個(gè)空缺地區(qū),稱之為一幀,每一個(gè)控制占有一幀。選用幀布局時(shí),全部控制都默認(rèn)設(shè)置展示在顯示屏左上方,并依據(jù)依次放進(jìn)順序重合放置,先放進(jìn)的將在底層,然后放入的控制展示在最高層。幀布局應(yīng)用于涂層設(shè)計(jì)方案。
特性
foreground :設(shè)定幀布局容器的市場(chǎng)前景圖象
foregroundGravity :特性設(shè)定圖片的顯示位置
看代碼
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@mipmap/ic_launcher"
android:foregroundGravity="bottom">
android:id="@ id/textView"
android:layout_width="460dp"
android:layout_height="336dp"
android:background="@color/colorAccent"
android:text="TextView" />
android:id="@ id/textView2"
android:layout_width="332dp"
android:layout_height="242dp"
android:background="@color/colorPrimary"
android:text="TextView" />
設(shè)計(jì)效果圖

原創(chuàng)文章,作者:leping,如若轉(zhuǎn)載,請(qǐng)注明出處:http://www.kyxa.cn/biao-4251.html