Android:LinearLayout布局和其嵌套运用举例
2012-03-22 19:42
477 查看
==========================
main.xml
看mars老师的视频学习安卓里面的布局部分,做的样例,显摆一下,全部都是在main.xml里面配置的。
==========================
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1" android:background="#0000aa" android:gravity="center_vertical" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1" android:background="#00aa00" android:gravity="center_vertical" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1" android:background="#0000aa" android:gravity="center_vertical" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1" android:background="#00aa00" android:gravity="center_vertical" android:text="@string/hello" android:textSize="30dp" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#00aa00" android:gravity="center_horizontal" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#0000aa" android:gravity="center_horizontal" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#00aa00" android:gravity="center_horizontal" android:text="@string/hello" android:textSize="30dp" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#0000aa" android:gravity="center_horizontal" android:text="@string/hello" android:textSize="30dp" /> </LinearLayout> </LinearLayout>
相关文章推荐
- Android: LinearLayout布局和其嵌套运用举例
- Android应用的LinearLayout中嵌套RelativeLayout的布局用法
- Android Studio App LinearLayout多层布局嵌套
- 初入android之LinearLayout嵌套线性布局
- 【Android】关于百分比布局多个LinearLayout嵌套时出现的问题与解决方案
- Android App中的多个LinearLayout嵌套布局实例解析
- Android LinearLayout布局嵌套及权重weight的使用
- Android应用的LinearLayout中嵌套RelativeLayout的布局用法
- Android Studio App LinearLayout多层布局嵌套
- Android布局之LinearLayout与TableLayout的嵌套使用
- Android布局控件之LinearLayout详解
- android之Linearlayout布局下,如何将一个控件置于底部
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout
- android布局之LinearLayout, layout_weight很有用
- android 较高版本,页面分割线实现LinearLayoutCompat布局简单事例
- 浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout
- android之线性布局LinearLayout以及weight权重使用
- android LinearLayout布局中layout_weight的使用(二)
- Android常用布局之LinearLayout(线性布局)仿酷狗登录界面
- android LinearLayout和RelativeLayout实现精确布局