Android 相对布局

 

  1. <?xml version="1.0" encoding="utf-8"?>  
  2.   
  3. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  4.     android:layout_width="fill_parent"  
  5.     android:layout_height="wrap_content"  
  6.     android:padding="10px"  
  7.     >  
  8.     <TextView  
  9.         android:id="@+id/lable"  
  10.         android:text="Type here:"  
  11.         android:layout_width="fill_parent"  
  12.         android:layout_height="wrap_content"  
  13.     />  
  14.       
  15.     <EditText  
  16.         android:id="@+id/entry"  
  17.         android:layout_width="fill_parent"  
  18.         android:layout_height="wrap_content"  
  19.         android:background="@android:drawable/editbox_background"  
  20.         android:layout_below="@id/lable"  
  21.     />  
  22.       
  23.     <Button  
  24.         android:id="@+id/ok"  
  25.         android:layout_width="wrap_content"  
  26.         android:layout_height="wrap_content"  
  27.         android:text="OK"  
  28.         android:layout_below="@id/entry"  
  29.         android:layout_marginLeft="10px"  
  30.         android:layout_alignParentRight="true"  
  31.     />  
  32.       
  33.     <Button  
  34.         android:id="@+id/cancel"  
  35.         android:layout_width="wrap_content"  
  36.         android:layout_height="wrap_content"  
  37.         android:layout_toLeftOf="@id/ok"  
  38.         android:layout_alignTop="@id/ok"  
  39.         android:text="Cancel"  
  40.     />  
  41. </RelativeLayout> 

 

 

 

posted @ 2012-05-24 19:18  CJin  阅读(211)  评论(0编辑  收藏  举报