1<?xml version="1.0" encoding="utf-8"?> 2<!-- 3 ~ Copyright (C) 2022 The Android Open Source Project 4 ~ 5 ~ Licensed under the Apache License, Version 2.0 (the "License"); 6 ~ you may not use this file except in compliance with the License. 7 ~ You may obtain a copy of the License at 8 ~ 9 ~ http://www.apache.org/licenses/LICENSE-2.0 10 ~ 11 ~ Unless required by applicable law or agreed to in writing, software 12 ~ distributed under the License is distributed on an "AS IS" BASIS, 13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ~ See the License for the specific language governing permissions and 15 ~ limitations under the License. 16 --> 17 18<!-- 19 Demonstrates Keep-Clear areas API. 20 --> 21<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 22 xmlns:tools="http://schemas.android.com/tools" 23 android:id="@+id/container" 24 android:layout_width="match_parent" 25 android:layout_height="match_parent" 26 android:gravity="top|start"> 27 <TextView 28 android:id="@+id/keep_clear_view" 29 android:layout_width="wrap_content" 30 android:layout_height="wrap_content" 31 android:preferKeepClear="true" 32 android:gravity="center_vertical|center_horizontal" 33 android:textAppearance="?android:attr/textAppearanceMedium" 34 android:text="@string/keep_clear_property_set" 35 android:background="@color/transparent_red"/> 36 37 <Switch 38 android:id="@+id/set_prefer_keep_clear_toggle" 39 android:layout_width="match_parent" 40 android:layout_height="wrap_content" 41 android:layout_below="@+id/keep_clear_view" 42 android:padding="@dimen/keep_clear_text_view_padding" 43 android:text="@string/keep_clear_set_prefer_keep_clear_toggle" /> 44 45 <Switch 46 android:id="@+id/set_bottom_right_rectangle_keep_clear_toggle" 47 android:layout_width="match_parent" 48 android:layout_height="wrap_content" 49 android:layout_below="@+id/set_prefer_keep_clear_toggle" 50 android:padding="@dimen/keep_clear_text_view_padding" 51 android:text="@string/keep_clear_set_bottom_right_rectangle_keep_clear_toggle" /> 52 53 <TextView 54 android:id="@+id/keep_clear_view_bottom_right" 55 android:layout_width="wrap_content" 56 android:layout_height="@dimen/keep_clear_text_view_size" 57 android:gravity="center_vertical|center_horizontal" 58 android:layout_alignParentBottom="true" 59 android:layout_alignParentEnd="true" 60 android:textAppearance="?android:attr/textAppearanceMedium" 61 android:text="@string/keep_clear_view_bottom_right" 62 android:background="@color/transparent_green"/> 63</RelativeLayout> 64