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