blob: 4d1dca7105d8283e4141be66610659988938b4d2 [file] [log] [blame]
Tony Mantlere7841c02016-06-08 15:31:40 -07001<?xml version="1.0" encoding="utf-8"?>
2<!--
3 ~ Copyright (C) 2016 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<!-- This is a primitive example showing the different types of preferences available. -->
19<!-- BEGIN_INCLUDE(preferences) -->
20<PreferenceScreen
21 xmlns:android="http://schemas.android.com/apk/res/android"
22 android:title="@string/root_title">
23
Tony Mantlerc01b6232016-09-13 15:54:12 -070024 <Preference
25 android:key="basic_preference"
26 android:title="@string/title_basic_preference"
27 android:summary="@string/summary_basic_preference" />
28
29 <Preference
30 android:key="stylish_preference"
31 android:title="@string/title_stylish_preference"
32 android:summary="@string/summary_stylish_preference" />
33
Antony Sargentb64ee382017-11-07 12:53:33 -080034 <Preference
35 android:key="preference_with_icon"
36 android:title="Preference with icon"
37 android:summary="This preference has an icon"
38 android:icon="@android:drawable/ic_menu_camera" />
39
Tony Mantlere7841c02016-06-08 15:31:40 -070040 <PreferenceCategory
41 android:title="@string/inline_preferences">
42
43 <CheckBoxPreference
44 android:key="checkbox_preference"
45 android:title="@string/title_checkbox_preference"
46 android:summary="@string/summary_checkbox_preference" />
47
Antony Sargentb64ee382017-11-07 12:53:33 -080048 <SwitchPreference
49 android:key="switch_preference"
50 android:title="Switch preference"
51 android:summary="This is a switch" />
52
Tony Mantler6548b1a2016-07-26 11:16:17 -070053 <DropDownPreference
54 android:key="dropdown_preference"
55 android:title="@string/title_dropdown_preference"
56 android:summary="@string/summary_dropdown_preference"
57 android:entries="@array/entries_list_preference"
58 android:entryValues="@array/entryvalues_list_preference" />
59
Tony Mantlere7841c02016-06-08 15:31:40 -070060 </PreferenceCategory>
61
62 <PreferenceCategory
63 android:title="@string/dialog_based_preferences">
64
65 <EditTextPreference
66 android:key="edittext_preference"
67 android:title="@string/title_edittext_preference"
68 android:summary="@string/summary_edittext_preference"
69 android:dialogTitle="@string/dialog_title_edittext_preference" />
70
71 <ListPreference
72 android:key="list_preference"
73 android:title="@string/title_list_preference"
74 android:summary="@string/summary_list_preference"
75 android:entries="@array/entries_list_preference"
76 android:entryValues="@array/entryvalues_list_preference"
77 android:dialogTitle="@string/dialog_title_list_preference" />
78
Tony Mantler31453bc2016-07-11 14:51:58 -070079 <MultiSelectListPreference
80 android:key="multi_select_list_preference"
81 android:title="@string/title_multi_list_preference"
82 android:summary="@string/summary_multi_list_preference"
83 android:entries="@array/entries_list_preference"
84 android:entryValues="@array/entryvalues_list_preference"
85 android:dialogTitle="@string/dialog_title_multi_list_preference" />
86
Tony Mantlere7841c02016-06-08 15:31:40 -070087 </PreferenceCategory>
88
89 <PreferenceCategory
90 android:title="@string/launch_preferences">
91
92 <!-- This PreferenceScreen tag serves as a screen break (similar to page break
93 in word processing). Like for other preference types, we assign a key
94 here so it is able to save and restore its instance state. -->
95 <PreferenceScreen
96 android:key="screen_preference"
97 android:title="@string/title_screen_preference"
98 android:summary="@string/summary_screen_preference">
99
100 <!-- You can place more preferences here that will be shown on the next screen. -->
101
102 <CheckBoxPreference
103 android:key="next_screen_checkbox_preference"
104 android:title="@string/title_next_screen_toggle_preference"
105 android:summary="@string/summary_next_screen_toggle_preference" />
106
107 </PreferenceScreen>
108
109 <PreferenceScreen
110 android:title="@string/title_intent_preference"
111 android:summary="@string/summary_intent_preference">
112
113 <intent android:action="android.intent.action.VIEW"
114 android:data="http://www.android.com" />
115
116 </PreferenceScreen>
117
118 </PreferenceCategory>
119
120 <PreferenceCategory
121 android:title="@string/preference_attributes">
122
123 <CheckBoxPreference
124 android:key="parent_checkbox_preference"
125 android:title="@string/title_parent_preference"
126 android:summary="@string/summary_parent_preference" />
127
128 <!-- The visual style of a child is defined by this styled theme attribute. -->
129 <CheckBoxPreference
130 android:key="child_checkbox_preference"
131 android:dependency="parent_checkbox_preference"
132 android:layout="?android:attr/preferenceLayoutChild"
133 android:title="@string/title_child_preference"
134 android:summary="@string/summary_child_preference" />
135
136 </PreferenceCategory>
137
138</PreferenceScreen>
139<!-- END_INCLUDE(preferences) -->