• 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<PreferenceScreen
19        xmlns:android="http://schemas.android.com/apk/res/android">
20
21    <PreferenceCategory
22            android:title="@string/inline_preferences">
23
24        <CheckBoxPreference
25                android:key="checkbox_preference"
26                android:title="@string/title_toggle_preference"
27                android:summary="@string/summary_toggle_preference" />
28
29    </PreferenceCategory>
30
31    <PreferenceCategory
32            android:title="@string/dialog_based_preferences">
33
34        <EditTextPreference
35                android:key="edittext_preference"
36                android:title="@string/title_edittext_preference"
37                android:summary="@string/summary_edittext_preference"
38                android:dialogTitle="@string/dialog_title_edittext_preference" />
39
40        <ListPreference
41                android:key="list_preference"
42                android:title="@string/title_list_preference"
43                android:summary="@string/summary_list_preference"
44                android:entries="@array/entries_list_preference"
45                android:entryValues="@array/entryvalues_list_preference"
46                android:dialogTitle="@string/dialog_title_list_preference" />
47
48    </PreferenceCategory>
49
50    <PreferenceCategory
51            android:title="@string/launch_preferences">
52
53        <!-- This PreferenceScreen tag serves as a screen break (similar to page break
54             in word processing). Like for other preference types, we assign a key
55             here so it is able to save and restore its instance state. -->
56        <PreferenceScreen
57                android:key="screen_preference"
58                android:title="@string/title_screen_preference"
59                android:summary="@string/summary_screen_preference">
60
61            <!-- You can place more preferences here that will be shown on the next screen. -->
62
63            <CheckBoxPreference
64                    android:key="next_screen_checkbox_preference"
65                    android:title="@string/title_next_screen_toggle_preference"
66                    android:summary="@string/summary_next_screen_toggle_preference" />
67
68        </PreferenceScreen>
69
70        <PreferenceScreen
71                android:title="@string/title_intent_preference"
72                android:summary="@string/summary_intent_preference">
73
74            <intent android:action="android.intent.action.VIEW"
75                    android:data="http://www.android.com" />
76
77        </PreferenceScreen>
78
79    </PreferenceCategory>
80
81    <PreferenceCategory
82            android:title="@string/preference_attributes">
83
84        <CheckBoxPreference
85                android:key="parent_checkbox_preference"
86                android:title="@string/title_parent_preference"
87                android:summary="@string/summary_parent_preference" />
88
89        <!-- The visual style of a child is defined by this styled theme attribute. -->
90        <CheckBoxPreference
91                android:key="child_checkbox_preference"
92                android:dependency="parent_checkbox_preference"
93                android:layout="?android:attr/preferenceLayoutChild"
94                android:title="@string/title_child_preference"
95                android:summary="@string/summary_child_preference" />
96
97    </PreferenceCategory>
98
99</PreferenceScreen>
100