Android学习笔记之android:collapseColumns,android:shrinkColumns和stretchColumn
生活随笔
收集整理的這篇文章主要介紹了
Android学习笔记之android:collapseColumns,android:shrinkColumns和stretchColumn
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
TableLayout是一個使用復雜的布局,最簡單的用法就僅僅是拖拉控件做出個界面,但實際上,會經常在代碼里使用TableLayout,例如做出表格的效果。本文主要介紹TableLayout的基本使用方法。
?
<?xml version="1.0" encoding="utf-8"?>?
?<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"?
?????????????? android:layout_width="fill_parent"?
?????????????? android:layout_height="fill_parent"?
?????????????? > ?
???? <TableRow>?
???? <Button??
???????? android:id="@+id/button1"?
???????? android:layout_width="wrap_content"?
???????? android:layout_height="wrap_content"?????????????
???????? android:text="Button1"?
???????? android:layout_column="0"/>?
?? ???<Button??
????????? android:id="@+id/button2"?
????????? android:layout_width="wrap_content"?
????????? android:layout_height="wrap_content"?
????????? android:text="Hello, I am a Button2"?
????????? android:layout_column="1"/>?
???? </TableRow>?
?</TableLayout>? ?
www.2cto.com
?
?
<?xml version="1.0" encoding="utf-8"?>?
?<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"?
?????????????? android:layout_width="fill_parent"?
?????????????? android:layout_height="fill_parent"?
?????????????? > ?
???? <TableRow>?
???? <Button??
???????? android:id="@+id/button1"?
???????? android:layout_width="wrap_content"?
???????? android:layout_height="wrap_content"?????????????
???????? android:text="Button1"?
???????? android:layout_column="0"/>?
?? ???<Button??
????????? android:id="@+id/button2"?
????????? android:layout_width="wrap_content"?
????????? android:layout_height="wrap_content"?
????????? android:text="Hello, I am a Button2"?
????????? android:layout_column="1"/>?
???? </TableRow>?
?</TableLayout>? ?
www.2cto.com
?
1?android:stretchColumns = "指定的列"?------->以第0行為序,盡量把指定的列填充空白部分
設置stretchColumns=0,則結果如下圖,第0列被盡量填充
總結
以上是生活随笔為你收集整理的Android学习笔记之android:collapseColumns,android:shrinkColumns和stretchColumn的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (android实战)Service 生
- 下一篇: 解决错误:Re-installation