Home | History | Annotate | Download | only in xml
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!-- Copyright (C) 2012 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_checkbox_preference"
     27                 android:summary="@string/summary_checkbox_preference" />
     28 
     29         <SwitchPreference
     30                 android:key="checkbox_preference"
     31                 android:title="@string/title_switch_preference"
     32                 android:summary="@string/summary_switch_preference" />
     33 
     34     </PreferenceCategory>
     35 
     36     <PreferenceCategory
     37             android:title="@string/dialog_based_preferences">
     38 
     39         <EditTextPreference
     40                 android:key="edittext_preference"
     41                 android:title="@string/title_edittext_preference"
     42                 android:summary="@string/summary_edittext_preference"
     43                 android:dialogTitle="@string/dialog_title_edittext_preference" />
     44 
     45         <ListPreference
     46                 android:key="list_preference"
     47                 android:title="@string/title_list_preference"
     48                 android:summary="@string/summary_list_preference"
     49                 android:entries="@array/entries_list_preference"
     50                 android:entryValues="@array/entryvalues_list_preference"
     51                 android:dialogTitle="@string/dialog_title_list_preference" />
     52 
     53     </PreferenceCategory>
     54 
     55     <PreferenceCategory
     56             android:title="@string/launch_preferences">
     57 
     58         <!-- This PreferenceScreen tag sends the user to a new fragment of
     59              preferences.  If running in a large screen, they can be embedded
     60              inside of the overall preferences UI. -->
     61         <PreferenceScreen
     62                 android:fragment="
     63                     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 
    103