结果
Main.XML
<? xml version="1.0" encoding="utf-8" ?> < LinearLayout xmlns: android ="http://schemas. android .com/apk/res/android" android:layout_width ="fill_parent" android:layout_height ="fill_parent" android:orientation ="vertical" > < RelativeLayout android:id ="@+id/Relativelayout01" android:background ="@drawable/head_bg" android:layout_width ="fill_parent" android:layout_height ="42dp" > < ImageButton android:id ="@+id/a" android:layout_width ="36dp" android:layout_height ="27dp" android:layout_toLeftOf ="@id/Relativelayout01" android:src ="@drawable/back" android:layout_marginTop ="10dp" /> < ImageButton android:id ="@+id/b" android:layout_width ="125dp" android:layout_height ="27dp" android:layout_centerInParent ="true" android:src ="@drawable/logo" /> < ImageButton android:id ="@+id/c" android:layout_width ="48dp" android:layout_height ="27dp" android:layout_alignParentRight ="true" android:src ="@drawable/login" android:layout_marginTop ="10dp" /> RelativeLayout > LinearLayout > RelativeLayout用到的一些重要的属性:
第一类:属性值为true或false
第二类:属性值必须为id的引用名“@id/id-name”
android:layout_alignTop 本元素的上边缘和某元素的的上边缘对齐
第三类:属性值为具体的像素值,如30dip,40px
|