设置Preference Screen
(res\xml\userpreferences.xml)
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:defaultValue="true"
android:key="PREF_VIBRATE"
android:title="VIBRATE" /> <Preference
android:key="button"
android:title="Rimind Distance" /> </PreferenceScreen>
(UserPreferenceFragment.java)
addPreferencesFromResource(R.xml.userpreferences);
(FragmentPreferences.java)
getFragmentManager().beginTransaction().replace(android.R.id.content, new UserPreferenceFragment())
.commit();