1ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov<?xml version="1.0" encoding="utf-8"?> 2ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov<!-- Copyright (C) 2016 The Android Open Source Project 3ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 4ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov Licensed under the Apache License, Version 2.0 (the "License"); 5ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov you may not use this file except in compliance with the License. 6ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov You may obtain a copy of the License at 7ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 8ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov http://www.apache.org/licenses/LICENSE-2.0 9ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 10ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov Unless required by applicable law or agreed to in writing, software 11ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov distributed under the License is distributed on an "AS IS" BASIS, 12ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov See the License for the specific language governing permissions and 14ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov limitations under the License. 15ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov--> 16ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 17ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov<android.support.percent.PercentRelativeLayout 18ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov xmlns:android="http://schemas.android.com/apk/res/android" 19ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov xmlns:app="http://schemas.android.com/apk/res-auto" 20ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/container" 21ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_width="match_parent" 22ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_height="match_parent"> 23ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 24ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <!-- This child is anchored along the top edge of the parent, testing percent-based 25ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov left margin, top margin and width, as well as the aspect ratio. --> 26ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <View 27ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/child_top" 28ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentTop="true" 29ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_widthPercent="50%" 30ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_aspectRatio="2000%" 31ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginLeftPercent="20%" 32ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginTopPercent="5%" 33ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:background="#5690E0" /> 34ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 35ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <!-- This child is anchored along the left edge of the parent, testing percent-based 36ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov left margin, top margin and height, as well as the aspect ratio. --> 37ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <View 38ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/child_left" 39ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentLeft="true" 40ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_heightPercent="50%" 41ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_aspectRatio="5%" 42ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginLeftPercent="5%" 43ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginTopPercent="20%" 44ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:background="#902030" /> 45ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 46ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <!-- This child is anchored along the bottom edge of the parent, testing percent-based 47ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov right margin, bottom margin and width, as well as the aspect ratio. --> 48ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <View 49ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/child_bottom" 50ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentBottom="true" 51ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentRight="true" 52ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_widthPercent="40%" 53ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_aspectRatio="2000%" 54ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginRightPercent="20%" 55ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginBottomPercent="5%" 56ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:background="#A0B040" /> 57ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 58ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <!-- This child is anchored along the right edge of the parent, testing percent-based 59ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov right margin, bottom margin and height, as well as the aspect ratio. --> 60ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <View 61ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/child_right" 62ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentBottom="true" 63ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_alignParentRight="true" 64ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_heightPercent="40%" 65ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_aspectRatio="5%" 66ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginRightPercent="5%" 67ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginBottomPercent="20%" 68ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:background="#20C0A0" /> 69ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 70ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <!-- This child is anchored to be in the "center" of the parent by anchoring it with 71ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov percent-based margins relatively to its edge-aligned siblings. --> 72ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov <View 73ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:id="@+id/child_center" 74ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_width="match_parent" 75ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_height="match_parent" 76ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_below="@+id/child_top" 77ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_toRightOf="@+id/child_left" 78ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_toLeftOf="@+id/child_right" 79ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:layout_above="@+id/child_bottom" 80ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov app:layout_marginPercent="10%" 81ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov android:background="#F07020" /> 82ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 83ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov</android.support.percent.PercentRelativeLayout> 84ff6cfa41a3c76a979795b32985f8e1f7157cb33cKirill Grouchnikov 85