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