Preference Screen 首选项

 设置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();

 

posted @ 2013-09-18 07:55  lawdong  Views(397)  Comments(0Edit  收藏  举报
http://home.cnblogs.com/ing/