Android第六課——Android的布局初步3——多個Layout嵌套布局

來源:互聯網
上載者:User

 如果看了我上面的兩個Layout布局的代碼的話對這個肯定感覺不到什麼難度,那我就先把結果圖貼出來,我是先看了成果自己寫的,嵌套中有三個LinearLayout。這個有點像Div+Css...不大複雜。貼圖咯。

如果大家已經把上面的寫出來就不要看下面的代碼了。這一節只是一個總結,下一節比較精彩。

main.xml

<?xml version="1.0" encoding="utf-8"?><br /><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"<br /> android:orientation = "vertical"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "fill_parent"<br /> ></p><p> <LinearLayout<br /> android:orientation = "horizontal"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"></p><p> <TextView<br /> android:text = "red"<br /> android:gravity = "center_horizontal"<br /> android:background = "#aa0000"<br /> android:layout_width = "wrap_content"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "green"<br /> android:gravity = "center_horizontal"<br /> android:background = "#00aa00"<br /> android:layout_width = "wrap_content"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "blue"<br /> android:gravity = "center_horizontal"<br /> android:background = "#0000aa"<br /> android:layout_width = "wrap_content"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "yellow"<br /> android:gravity = "center_horizontal"<br /> android:background = "#aaaa00"<br /> android:layout_width = "wrap_content"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"/><br /> </LinearLayout></p><p> <LinearLayout<br /> android:orientation = "vertical"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "fill_parent"<br /> android:layout_weight = "1"></p><p> <TextView<br /> android:text = "row one"<br /> android:textSize = "15pt"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "wrap_content"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "row two"<br /> android:textSize = "15pt"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "wrap_content"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "row three"<br /> android:textSize = "15pt"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "wrap_content"<br /> android:layout_weight = "1"/><br /> <TextView<br /> android:text = "row four"<br /> android:textSize = "15pt"<br /> android:layout_width = "fill_parent"<br /> android:layout_height = "wrap_content"<br /> android:layout_weight = "1"/><br /> </LinearLayout></p><p></LinearLayout><br />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.