Android五大布局对象:FrameLayout,LinearLayout,AbsoluteLayout,RelativeLayout,TableLayout.
2010-09-27 01:45:00 来源:WEB开发网我们看一下效果图:
其中Main.xm l代码如下:
< ?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="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2">
< TextView
android:text="Welcome to Mr Wei's blog"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
< /LinearLayout>
< 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"/>
< /LinearLayout>
更多精彩
赞助商链接