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)java

addPreferencesFromResource(R.xml.userpreferences);

(FragmentPreferences.java)android

getFragmentManager().beginTransaction().replace(android.R.id.content, new UserPreferenceFragment())
              .commit();
相關文章
相關標籤/搜索