与 xml 混合动态填充的首选项
我有一个加载此资源的首选项活动:
<PreferenceScreen>
<PreferenceCategory
android:title="@string/venues"
android:key="venues_category">
<PreferenceScreen
android:title="@string/venues"
android:summary="@string/selectToFilter">
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/network"
android:key="network_category">
<ListPreference
android:key="updates_interval"
android:title="Updates interval"
android:summary="Define how often updates will be performed"
android:defaultValue="1000"
android:entries="@array/updateInterval"
android:entryValues="@array/updateIntervalValues" />
</PreferenceCategory>
第一个首选项类别内部有一个新的Preference Screen
,但必须动态填充。我怎样才能做到这一点?我如何参考该偏好屏幕以及在哪里?
I have a preference activity that loads this resource:
<PreferenceScreen>
<PreferenceCategory
android:title="@string/venues"
android:key="venues_category">
<PreferenceScreen
android:title="@string/venues"
android:summary="@string/selectToFilter">
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/network"
android:key="network_category">
<ListPreference
android:key="updates_interval"
android:title="Updates interval"
android:summary="Define how often updates will be performed"
android:defaultValue="1000"
android:entries="@array/updateInterval"
android:entryValues="@array/updateIntervalValues" />
</PreferenceCategory>
The first preference category has a new Preference Screen
inside, but it has to be filled dynamically. How can I do that? How can I refer to that preference screen and where?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么类别中有 PreferenceScreen?
您可以动态创建首选项
参考这个示例代码
http://developer.android .com/resources/samples/ApiDemos/src/com/example/android/apis/preference/PreferencesFromCode.html
Why is there a PreferenceScreen Inside a Category?
You can create Preferences dynamically
Refer to this sample code
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/preference/PreferencesFromCode.html