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