매일코딩/안드로이드
[안드로이드 기초] 상대 레이아웃
인생여희
2017. 8. 24. 17:30
반응형
상대 레이아웃
#화면
#소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:id="@+id/r1" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/r2" android:background="#fff000"></RelativeLayout> <RelativeLayout android:id="@+id/r2" android:layout_width="100dp" android:layout_height="100dp" android:layout_above="@id/r4" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="#4c219e"></RelativeLayout> <RelativeLayout android:id="@+id/r3" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_below="@id/r1" android:background="#694430"></RelativeLayout> <RelativeLayout android:id="@+id/r4" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_toRightOf="@id/r3" android:background="#00f957"></RelativeLayout> <RelativeLayout android:id="@+id/r5" android:layout_width="100dp" android:layout_height="100dp" android:layout_above="@id/r4" android:layout_below="@id/r1" android:layout_toLeftOf="@id/r2" android:layout_toRightOf="@id/r3" android:background="#f45eff"></RelativeLayout> </RelativeLayout> | cs |
반응형