• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2010 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    </PreferenceCategory>
36
37    <PreferenceCategory
38            android:title="@string/dialog_based_preferences">
39
40        <EditTextPreference
41                android:key="edittext_preference"
42                android:title="@string/title_edittext_preference"
43                android:summary="@string/summary_edittext_preference"
44                android:dialogTitle="@string/dialog_title_edittext_preference" />
45
46        <ListPreference
47                android:key="list_preference"
48                android:title="@string/title_list_preference"
49                android:summary="@string/summary_list_preference"
50                android:entries="@array/entries_list_preference"
51                android:entryValues="@array/entryvalues_list_preference"
52                android:dialogTitle="@string/dialog_title_list_preference" />
53
54    </PreferenceCategory>
55
56    <PreferenceCategory
57            android:title="@string/launch_preferences">
58
59        <!-- This PreferenceScreen tag sends the user to a new fragment of
60             preferences.  If running in a large screen, they can be embedded
61             inside of the overall preferences UI. -->
62        <PreferenceScreen
63                android:fragment="com.example.android.apis.preference.PreferenceWithHeaders$Prefs1FragmentInner"
64                android:title="@string/title_fragment_preference"
65                android:summary="@string/summary_fragment_preference">
66            <!-- Arbitrary key/value pairs can be included for fragment arguments -->
67            <extra android:name="someKey" android:value="somePrefValue" />
68        </PreferenceScreen>
69
70        <!-- This PreferenceScreen tag sends the user to a completely different
71             activity, switching out of the current preferences UI. -->
72        <PreferenceScreen
73                android:title="@string/title_intent_preference"
74                android:summary="@string/summary_intent_preference">
75
76            <intent android:action="android.intent.action.VIEW"
77                    android:data="http://www.android.com" />
78
79        </PreferenceScreen>
80
81    </PreferenceCategory>
82
83    <PreferenceCategory
84            android:title="@string/preference_attributes">
85
86        <CheckBoxPreference
87                android:key="parent_checkbox_preference"
88                android:title="@string/title_parent_preference"
89                android:summary="@string/summary_parent_preference" />
90
91        <!-- The visual style of a child is defined by this styled theme attribute. -->
92        <CheckBoxPreference
93                android:key="child_checkbox_preference"
94                android:dependency="parent_checkbox_preference"
95                android:layout="?android:attr/preferenceLayoutChild"
96                android:title="@string/title_child_preference"
97                android:summary="@string/summary_child_preference" />
98
99    </PreferenceCategory>
100
101</PreferenceScreen>
102<!-- END_INCLUDE(preferences) -->
103