介面排版-TableLayout的stretchColumns方法

來源:互聯網
上載者:User

標籤:

1.先把XML內的預設RelativeLayout排版方式清空,在去Layout區拉一個TableLayout的到表單上,XML下會出現下面程式碼     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:stretchColumns="2"    >  (android:stretchColumns="2"是設定 TableLayout所有行的第二列是擴展列,列是指上下,行是左右,假設每行都有三列(三個物件),剩下空間會由第二列補齊,下面會做示範)     </TableLayout> 2.在Layout拉一個TableRow出來,在TableLayout標籤之間會夾著TableRow     <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:stretchColumns="2"    >         <TableRow            android:id="@+id/tableRow1"            android:layout_width="wrap_content"            android:layout_height="wrap_content" >        </TableRow>     </TableLayout>  3.在去widget拉一個物件button出來,如圖片接下來再拉一個buttonOK,還是沒變化因為android:stretchColumns="2"是設定第二列才開始填滿,好!在拉一次button我們發現真的在第二列開始填滿剩下的空間了!也就是剩下空間會由第二列補齊(最左邊是第0列,以此類推)

介面排版-TableLayout的stretchColumns方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.