Android开发之路——Android的布局初步3——多个Layout嵌套布局
Android开发之路——Android的布局初步3——多个Layout嵌套布局
如果看了我上面的两个Layout布局(见Android开发之路——Android的布局初步 与 Android开发之路——Android的布局初步2——TableLayout布局)的代码的话对这个肯定感觉不到什么难度,那我就先把结果图贴出来,我是先看了成果自己写的,嵌套中有三个LinearLayout。这个有点像Div+Css...不大复杂。贴图咯。
相关阅读:
Android开发之路——走进Android(工程结构剖析)
Android开发之路——第一个Android小程序(Android电话拨号器)
Android开发之路——第二个Android小程序(Android短信发送)
Android开发之路——第三个Android小程序(Android的Activity显示)
Android开发之路——Android的布局初步
Android开发之路——Android的布局初步2——TableLayout布局
Android开发之路——Android的布局初步3——多个Layout嵌套布局
Android开发之路——单选框,复选框,弹出框等控件操作
Android开发学习笔记补充记录——Activity的生命周期
如果大家已经把上面的写出来就不要看下面的代码了。这一节只是一个总结,下一节(见)比较精彩。
main.xml
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation = "vertical"
- android:layout_width = "fill_parent"
- android:layout_height = "fill_parent"
- >
- <LinearLayout
- android:orientation = "horizontal"
- android:layout_width = "fill_parent"
- android:layout_height = "fill_parent"
- android:layout_weight = "1">
- <TextView
- android:text = "red"
- android:gravity = "center_horizontal"
- android:background = "#aa0000"
- android:layout_width = "wrap_content"
- android:layout_height = "fill_parent"
- android:layout_weight = "1"/>
- <TextView
- android:text = "green"
- android:gravity = "center_horizontal"
- android:background = "#00aa00"
- android:layout_width = "wrap_content"
- android:layout_height = "fill_parent"
- android:layout_weight = "1"/>
- <TextView
- android:text = "blue"
- android:gravity = "center_horizontal"
- android:background = "#0000aa"
- android:layout_width = "wrap_content"
- android:layout_height = "fill_parent"
- android:layout_weight = "1"/>
- <TextView
- android:text = "yellow"
- android:gravity = "center_horizontal"
- android:background = "#aaaa00"
- android:layout_width = "wrap_content"
- android:layout_height = "fill_parent"
- android:layout_weight = "1"/>
- </LinearLayout>
- <LinearLayout
- android:orientation = "vertical"
- android:layout_width = "fill_parent"
- android:layout_height = "fill_parent"
- android:layout_weight = "1">
- <TextView
- android:text = "row one"
- android:textSize = "15pt"
- android:layout_width = "fill_parent"
- android:layout_height = "wrap_content"
- android:layout_weight = "1"/>
- <TextView
- android:text = "row two"
- android:textSize = "15pt"
- android:layout_width = "fill_parent"
- android:layout_height = "wrap_content"
- android:layout_weight = "1"/>
- <TextView
- android:text = "row three"
- android:textSize = "15pt"
- android:layout_width = "fill_parent"
- android:layout_height = "wrap_content"
- android:layout_weight = "1"/>
- <TextView
- android:text = "row four"
- android:textSize = "15pt"
- android:layout_width = "fill_parent"
- android:layout_height = "wrap_content"
- android:layout_weight = "1"/>
- </LinearLayout>
- </LinearLayout>
评论暂时关闭