RelativeLayout

RelativeLayout的一个简单的列子:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
   <TextView 
        android:id="@+id/txt01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="111111"
        android:background="#FF0000"
       />
   <TextView 
        android:id="@+id/txt02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="222222"
        android:background="#00FF00"
        android:layout_below="@id/txt01"
        android:layout_toRightOf="@id/txt01"
       />
</RelativeLayout>
View Code

 一些属性的使用:

android:layout_alignParentRight="true" //控件与容器向右对齐
android:padding="10px" //定义控件和容器的间隙的大小
android:layout_marginRight="30dp" //可以设置两个button之间的间距

  

posted @ 2013-06-08 00:08  zhang1107  阅读(149)  评论(0编辑  收藏  举报