2、 LinearLayout:线性布局;
<?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" 高度
>
android:id="@+id/firstText" 为控件指定相应ID
android:text="第一行" 指定控件当中显示的文字,需要注意的是,这里尽量使用string.xml
android:gravity="center_vertical" 指定控件的基本位置,比如说居中,居右等位置
android:textSize="35pt" 指定控件当中字体的大小
android:background="#aa0000" 指定该 控件所使用的背景颜色,RGB命名法
android:layout_width="fill_parent" 充满控件
android:layout_height="warp_content"保住内容
android:paddingLeft="10dip"指定控件的内边距,也就是说控件的当中的位置
android:layout_weight="1" 位置是1 做为两个控件,两件控件一起充满着,但是有百分比
android:singleLine="true"如果设置为真的话,则将控件的内容在同一行不如进行显示
原文:http://blog.csdn.net/jijunyuan/article/details/18362289