Skip to content

Instantly share code, notes, and snippets.

@PaulTR
Created September 16, 2015 18:08
Show Gist options
  • Save PaulTR/cb3eae2561c6709efc41 to your computer and use it in GitHub Desktop.
Save PaulTR/cb3eae2561c6709efc41 to your computer and use it in GitHub Desktop.
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="This is a test">
<PreferenceCategory
android:title="Inline Preference">
<CheckBoxPreference
android:key="checkbox_preference"
android:title="CheckboxPreference"
android:summary="Checkbox Preference Summary" />
</PreferenceCategory>
<PreferenceCategory
android:title="Dialog Preference">
<EditTextPreference
android:key="edittext_preference"
android:title="Edit Text Preference"
android:summary="Edit Text Preference Summary"
android:dialogTitle="Dialog Title Edit Text Preference" />
<ListPreference
android:key="list_preference"
android:title="List Preference"
android:summary="List Preference Summary"
android:entries="@array/entries_list_preference"
android:entryValues="@array/entries_list_preference"
android:dialogTitle="List Preference Dialog Title" />
</PreferenceCategory>
<PreferenceCategory
android:title="Launch Preference">
<!-- This PreferenceScreen tag serves as a screen break (similar to page break
in word processing). Like for other preference types, we assign a key
here so it is able to save and restore its instance state. -->
<PreferenceScreen
android:key="screen_preference"
android:title="Title Screen Preference"
android:summary="Summary Screen Preference">
<!-- You can place more preferences here that will be shown on the next screen. -->
<CheckBoxPreference
android:key="next_screen_checkbox_preference"
android:title="Next Screen Toggle Title"
android:summary="Next Screen Toggle Summary" />
</PreferenceScreen>
<PreferenceScreen
android:title="Intent Preference Title"
android:summary="Intent Preference Summary">
<intent android:action="android.intent.action.VIEW"
android:data="http://www.android.com" />
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
android:title="Attributes Title">
<CheckBoxPreference
android:key="parent_checkbox_preference"
android:title="Parent Preference Title"
android:summary="Parent Preference Summary" />
<!-- The visual style of a child is defined by this styled theme attribute. -->
<CheckBoxPreference
android:key="child_checkbox_preference"
android:dependency="parent_checkbox_preference"
android:layout="?android:attr/preferenceLayoutChild"
android:title="Child Preference Title"
android:summary="Child Preference Summary" />
</PreferenceCategory>
</PreferenceScreen>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment