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