1
2
3
4
5
|
dependencies {
compile 'com.android.support : percent : 22.2 . 0 '
}
|
1
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
|
< android.support.percent.PercentFrameLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "match_parent" />
< ImageView
app:layout_widthPercent = "50%"
app:layout_heightPercent = "50%"
app:layout_marginTopPercent = "25%"
app:layout_marginLeftPercent = "25%" />
</ android.support.percent.PercentFrameLayout />
|
01
02
03
04
05
06
07
08
09
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
< android.support.percent.PercentRelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
< View
android:id = "@+id/top_left"
android:layout_width = "0dp"
android:layout_height = "0dp"
android:layout_alignParentTop = "true"
android:background = "#ff0000"
app:layout_heightPercent = "30%"
app:layout_widthPercent = "70%" />
< View
android:id = "@+id/top_right"
android:layout_width = "0dp"
android:layout_height = "0dp"
android:layout_alignParentTop = "true"
android:layout_toRightOf = "@+id/top_left"
android:background = "#00ff00"
app:layout_heightPercent = "30%"
app:layout_widthPercent = "30%" />
< View
android:id = "@+id/centre"
android:layout_width = "match_parent"
android:layout_height = "0dp"
android:layout_below = "@+id/top_left"
android:background = "#0000ff"
app:layout_marginLeftPercent = "10%"
app:layout_marginRightPercent = "20%"
app:layout_marginTopPercent = "10%"
app:layout_marginBottomPercent = "10%"
app:layout_heightPercent = "40%" />
< View
android:layout_width = "match_parent"
android:layout_height = "0dp"
android:id = "@+id/bottom"
android:layout_below = "@+id/centre"
android:background = "#00f0ff"
android:layout_alignParentLeft = "true"
android:layout_alignParentStart = "true"
app:layout_heightPercent = "10%" />
</ android.support.percent.PercentRelativeLayout >
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
|
< View
android:id = "@+id/centre"
android:layout_width = "match_parent"
android:layout_height = "0dp"
android:layout_below = "@+id/top_left"
android:background = "#0000ff"
app:layout_marginLeftPercent = "10%"
app:layout_marginRightPercent = "20%"
app:layout_marginTopPercent = "10%"
app:layout_marginBottomPercent = "10%"
app:layout_heightPercent = "40%" />
|
1
2
3
4
5
6
7
8
9
|
< android.support.percent.PercentRelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "300dp" >
|
1
2
3
4
5
6
7
8
9
|
< android.support.percent.PercentRelativeLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:layout_width = "200dp"
android:layout_height = "match_parent" >
|