我PreferenceActivity用来保存一些默认值。
PreferenceActivity
我有一个包含Regions列表的数组,每个区域SubArray包含不同区域的列表。我的首选项列表项包含所有区域的列表,但是如何使listPrefernce在单击时显示另一个ListPreference,以便列出其子区域?
听起来您想使用http://developer.android.com/guide/topics/ui/settings.html#Subscreens中介绍的子屏幕
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <!-- opens a subscreen of settings --> <PreferenceScreen android:key="region1" android:title="Region 1" android:persistent="false"> <ListPreference android:key="subarray1" android:title="SubArray 1" ... /> <ListPreference android:key="subarray2" android:title="SubArray 2" ... /> .... </PreferenceScreen> <!-- opens another subscreen of settings --> <PreferenceScreen android:key="region2" android:title="Region 2" android:persistent="false"> <ListPreference android:key="subarray1" android:title="SubArray 1" ... /> <ListPreference android:key="subarray2" android:title="SubArray 2" ... /> ... </PreferenceScreen> ... </PreferenceScreen>