0
我正在使用PreferenceActivity
來保存一些默認值。使用PreferenceActivity的ListActivity選擇子類別
我有一個數組,其中包含區域列表和每個區域的子數組,其中包含不同區域的列表。我的偏好列表項目包含所有區域的列表,但是如何讓listPrefernce在點擊時顯示另一個ListPreference,以便列出它的子區域?
我正在使用PreferenceActivity
來保存一些默認值。使用PreferenceActivity的ListActivity選擇子類別
我有一個數組,其中包含區域列表和每個區域的子數組,其中包含不同區域的列表。我的偏好列表項目包含所有區域的列表,但是如何讓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>