android 学习

relativeLayout布局

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2 xmlns:tools="http://schemas.android.com/tools"
 3 android:id="@+id/RelativeLayout1"
 4 android:layout_width="match_parent"
 5 android:layout_height="match_parent" >
 6 
 7 <!-- 这个是在容器中央的 -->
 8 
 9 <ImageView
10 android:id="@+id/img1"
11 android:layout_width="80dp"
12 android:layout_height="80dp"
13 android:layout_centerInParent="true"
14 android:src="@drawable/pic1"/>
15 
16 <!-- 在中间图片的左边 -->
17 <ImageView
18 android:id="@+id/img2"
19 android:layout_width="80dp"
20 android:layout_height="80dp"
21 android:layout_toLeftOf="@id/img1"
22 android:layout_centerVertical="true"
23 android:src="@drawable/pic2"/>
24 
25 <!-- 在中间图片的右边 -->
26 <ImageView
27 android:id="@+id/img3"
28 android:layout_width="80dp"
29 android:layout_height="80dp"
30 android:layout_toRightOf="@id/img1"
31 android:layout_centerVertical="true"
32 android:src="@drawable/pic3"/>
33 
34 <!-- 在中间图片的上面-->
35 <ImageView
36 android:id="@+id/img4"
37 android:layout_width="80dp"
38 android:layout_height="80dp"
39 android:layout_above="@id/img1"
40 android:layout_centerHorizontal="true"
41 android:src="@drawable/pic4"/>
42 
43 <!-- 在中间图片的下面 -->
44 <ImageView
45 android:id="@+id/img5"
46 android:layout_width="80dp"
47 android:layout_height="80dp"
48 android:layout_below="@id/img1"
49 android:layout_centerHorizontal="true"
50 android:src="@drawable/pic5"/>
51 
52 </RelativeLayout>
原文地址:https://www.cnblogs.com/Nojava/p/14891973.html