开发者

How to launch PreferenceScreen from the parent one

开发者 https://www.devze.com 2023-02-13 14:00 出处:网络
I\'ve added in my app a simple AlertDialog that asks if the user wants to be redirected to the info PreferenceScreen. I\'d like to know how to launch a child开发者_如何学C PreferenceScreen from the pa

I've added in my app a simple AlertDialog that asks if the user wants to be redirected to the info PreferenceScreen. I'd like to know how to launch a child开发者_如何学C PreferenceScreen from the parent one.

Thanks.


I don't know what you mean by "info" PreferenceScreen, but when writing the preference xml file that you load in your PreferenceActivity subclass you can nest the PreferenceScreen tags:

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orderingFromXml="true" >
    <PreferenceScreen
        android:title="Child preference screen"
        android:summary="Description">
        <CheckBoxPreference
            android:defaultValue="false"
            android:key="check1"
            android:title="Checkbox"
            android:summaryOff="off"
            android:summaryOn="on" />
        </PreferenceScreen>
</PreferenceScreen>

The child preference screen will be show automatically when touching the entry in the parent preference screeen.


I've provided my solution for the similar question.

0

精彩评论

暂无评论...
验证码 换一张
取 消