**常用属性:
android:id ———————————— 为控件指定id
android:text —————————— 指定控件当中显示的文字
android:gravity ——————— 指定控件中内容的基本位置,比如居中,靠右等位置
android:textSize —————— 指定控件当中字体的大小
android:background ———— 指定该控件所使用的背景色,RGB命名法
android:orientation=”horizontal”/”vertical”设置内控件方向
android:width ————————— 指定控件的宽度
android:height ———————— 指定控件的高度
android:padding ——————— 指定控件的四个方向的内边距
android:paddingLeft———— 指定控件的左内边距
android:paddingRight——— 指定控件的右内边距
android:paddingTop ———— 指定控件的上内边距
android:paddingBottom — 指定控件的底内边距
android:sigleLine ————— 如果设置为真的话,则将控件中的内容在一行进行显示
android:layout_weight — 设置在LinearLayout控件中的填充权值
Demo:
<?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="rowone"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<TextView
android:text="rowtwo"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<TextView
android:text="rowthree"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<TextView
android:text="rowfour"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
UI截图: