• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2008 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16
17<!-- This is a primitive example showing the different types of preferences available. -->
18<!-- BEGIN_INCLUDE(preferences) -->
19<PreferenceScreen
20        xmlns:android="http://schemas.android.com/apk/res/android">
21
22    <PreferenceCategory
23            android:title="@string/inline_preferences">
24
25        <CheckBoxPreference
26                android:key="checkbox_preference"
27                android:title="@string/title_checkbox_preference"
28                android:summary="@string/summary_checkbox_preference" />
29
30        <SwitchPreference
31                android:key="checkbox_preference"
32                android:title="@string/title_switch_preference"
33                android:summary="@string/summary_switch_preference" />
34
35        <SwitchPreference
36                android:key="checkbox_preference"
37                android:title="@string/title_switch_preference"
38                android:summary="@string/summary_switch_preference_yes_no"
39                android:switchTextOn = "YES"
40                android:switchTextOff = "NO" />
41
42    </PreferenceCategory>
43
44    <PreferenceCategory
45            android:title="@string/dialog_based_preferences">
46
47        <EditTextPreference
48                android:key="edittext_preference"
49                android:title="@string/title_edittext_preference"
50                android:summary="@string/summary_edittext_preference"
51                android:dialogTitle="@string/dialog_title_edittext_preference" />
52
53        <ListPreference
54                android:key="list_preference"
55                android:title="@string/title_list_preference"
56                android:summary="@string/summary_list_preference"
57                android:entries="@array/entries_list_preference"
58                android:entryValues="@array/entryvalues_list_preference"
59                android:dialogTitle="@string/dialog_title_list_preference" />
60
61    </PreferenceCategory>
62
63    <PreferenceCategory
64            android:title="@string/launch_preferences">
65
66        <!-- This PreferenceScreen tag serves as a screen break (similar to page break
67             in word processing). Like for other preference types, we assign a key
68             here so it is able to save and restore its instance state. -->
69        <PreferenceScreen
70                android:key="screen_preference"
71                android:title="@string/title_screen_preference"
72                android:summary="@string/summary_screen_preference">
73
74            <!-- You can place more preferences here that will be shown on the next screen. -->
75
76            <CheckBoxPreference
77                    android:key="next_screen_checkbox_preference"
78                    android:title="@string/title_next_screen_toggle_preference"
79                    android:summary="@string/summary_next_screen_toggle_preference" />
80
81        </PreferenceScreen>
82
83        <PreferenceScreen
84                android:title="@string/title_intent_preference"
85                android:summary="@string/summary_intent_preference">
86
87            <intent android:action="android.intent.action.VIEW"
88                    android:data="http://www.android.com" />
89
90        </PreferenceScreen>
91
92    </PreferenceCategory>
93
94    <PreferenceCategory
95            android:title="@string/preference_attributes">
96
97        <CheckBoxPreference
98                android:key="parent_checkbox_preference"
99                android:title="@string/title_parent_preference"
100                android:summary="@string/summary_parent_preference" />
101
102        <!-- The visual style of a child is defined by this styled theme attribute. -->
103        <CheckBoxPreference
104                android:key="child_checkbox_preference"
105                android:dependency="parent_checkbox_preference"
106                android:layout="?android:attr/preferenceLayoutChild"
107                android:title="@string/title_child_preference"
108                android:summary="@string/summary_child_preference" />
109
110    </PreferenceCategory>
111
112</PreferenceScreen>
113<!-- END_INCLUDE(preferences) -->
114