xref: /aosp_15_r20/development/samples/ApiDemos/res/layout/switches.xml (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard Worker<?xml version="1.0" encoding="utf-8"?>
2*90c8c64dSAndroid Build Coastguard Worker<!-- Copyright (C) 2010 The Android Open Source Project
3*90c8c64dSAndroid Build Coastguard Worker
4*90c8c64dSAndroid Build Coastguard Worker     Licensed under the Apache License, Version 2.0 (the "License");
5*90c8c64dSAndroid Build Coastguard Worker     you may not use this file except in compliance with the License.
6*90c8c64dSAndroid Build Coastguard Worker     You may obtain a copy of the License at
7*90c8c64dSAndroid Build Coastguard Worker
8*90c8c64dSAndroid Build Coastguard Worker     http://www.apache.org/licenses/LICENSE-2.0
9*90c8c64dSAndroid Build Coastguard Worker
10*90c8c64dSAndroid Build Coastguard Worker     Unless required by applicable law or agreed to in writing, software
11*90c8c64dSAndroid Build Coastguard Worker     distributed under the License is distributed on an "AS IS" BASIS,
12*90c8c64dSAndroid Build Coastguard Worker     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*90c8c64dSAndroid Build Coastguard Worker     See the License for the specific language governing permissions and
14*90c8c64dSAndroid Build Coastguard Worker     limitations under the License.
15*90c8c64dSAndroid Build Coastguard Worker  -->
16*90c8c64dSAndroid Build Coastguard Worker<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
17*90c8c64dSAndroid Build Coastguard Worker            android:layout_width="match_parent"
18*90c8c64dSAndroid Build Coastguard Worker            android:layout_height="match_parent">
19*90c8c64dSAndroid Build Coastguard Worker    <LinearLayout
20*90c8c64dSAndroid Build Coastguard Worker         android:orientation="vertical"
21*90c8c64dSAndroid Build Coastguard Worker         android:layout_width="match_parent"
22*90c8c64dSAndroid Build Coastguard Worker         android:layout_height="wrap_content">
23*90c8c64dSAndroid Build Coastguard Worker
24*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="Standard switch"
25*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="wrap_content"
26*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
27*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
28*90c8c64dSAndroid Build Coastguard Worker
29*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="Default is on"
30*90c8c64dSAndroid Build Coastguard Worker                android:checked="true"
31*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="wrap_content"
32*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
33*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
34*90c8c64dSAndroid Build Coastguard Worker
35*90c8c64dSAndroid Build Coastguard Worker        <Switch android:id="@+id/monitored_switch"
36*90c8c64dSAndroid Build Coastguard Worker                android:text="Monitored switch"
37*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="wrap_content"
38*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
39*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
40*90c8c64dSAndroid Build Coastguard Worker
41*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="Customized text"
42*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="wrap_content"
43*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
44*90c8c64dSAndroid Build Coastguard Worker                android:textOn="YES"
45*90c8c64dSAndroid Build Coastguard Worker                android:textOff="NO"
46*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
47*90c8c64dSAndroid Build Coastguard Worker
48*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="This is an example of a switch with a lot of text in it. It may end up wrapping to another line. The switch will be pinned at the top."
49*90c8c64dSAndroid Build Coastguard Worker                android:singleLine="false"
50*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="300dip"
51*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
52*90c8c64dSAndroid Build Coastguard Worker                android:gravity="top|left"
53*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
54*90c8c64dSAndroid Build Coastguard Worker
55*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="This is an example of a switch with a lot of text in it. It may end up wrapping to another line. The switch will be vertically centered."
56*90c8c64dSAndroid Build Coastguard Worker                android:singleLine="false"
57*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="300dip"
58*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
59*90c8c64dSAndroid Build Coastguard Worker                android:gravity="center_vertical|left"
60*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
61*90c8c64dSAndroid Build Coastguard Worker
62*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="This is an example of a switch with a lot of text in it. It may end up wrapping to another line. The switch will be pinned at the bottom."
63*90c8c64dSAndroid Build Coastguard Worker                android:singleLine="false"
64*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="300dip"
65*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
66*90c8c64dSAndroid Build Coastguard Worker                android:gravity="bottom|left"
67*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
68*90c8c64dSAndroid Build Coastguard Worker
69*90c8c64dSAndroid Build Coastguard Worker        <Switch android:text="Switch with match_parent width"
70*90c8c64dSAndroid Build Coastguard Worker                android:layout_width="match_parent"
71*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content"
72*90c8c64dSAndroid Build Coastguard Worker                android:layout_marginBottom="32dip" />
73*90c8c64dSAndroid Build Coastguard Worker
74*90c8c64dSAndroid Build Coastguard Worker        <TextView android:text="Standalone switch below:"
75*90c8c64dSAndroid Build Coastguard Worker                  android:layout_width="wrap_content"
76*90c8c64dSAndroid Build Coastguard Worker                  android:layout_height="wrap_content" />
77*90c8c64dSAndroid Build Coastguard Worker
78*90c8c64dSAndroid Build Coastguard Worker        <Switch android:layout_width="wrap_content"
79*90c8c64dSAndroid Build Coastguard Worker                android:layout_height="wrap_content" />
80*90c8c64dSAndroid Build Coastguard Worker
81*90c8c64dSAndroid Build Coastguard Worker    </LinearLayout>
82*90c8c64dSAndroid Build Coastguard Worker</ScrollView>
83