如何在android中使用PreferenceActivity类的复选框
我有一些菜单设置,其中我有优先活动类。在PreferenceActivity中,我显示了复选框Preference,如下所示如何在android中使用PreferenceActivity类的复选框,android,synchronization,sharedpreferences,android-checkbox,Android,Synchronization,Sharedpreferences,Android Checkbox,我有一些菜单设置,其中我有优先活动类。在PreferenceActivity中,我显示了复选框Preference,如下所示 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:title="Options"> <CheckBoxPreference android:key="pref_opt
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory
android:title="Options">
<CheckBoxPreference
android:key="pref_opt1"
android:title="Option 1"
android:summary="Tick to set this option"
android:defaultValue="true"
/>
<CheckBoxPreference
android:key="pref_opt2"
android:title="Option 2"
android:summary="Tick to set this option"
android:defaultValue="true"
/>
</PreferenceCategory>
</PreferenceScreen>
查看此链接:@shre202,是的,这正是我想要的。非常感谢你。你救了我一天,不客气,朋友。
here is my PreferenceActivity:
public class SharedPref extends PreferenceActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.sharedpref);
}
// StorePreference method{
}
// readPreferences method{
}
}