gpt4 book ai didi

安卓 CheckBoxPreference : how to disable and enable other preferences on preference change

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:29:51 26 4
gpt4 key购买 nike

我有 CheckBoxPreference 和其他 2 个:一个是 Edit Test Pref。另一个是 ListBox Pref。我如何启用列表框首选项和禁用编辑文本首选项。 CheckBoxPreference 何时打开?

最佳答案

作为变体,可以将“依赖项”放入 ListBoxPref。

<PreferenceCategory
android:key="key1"
android:title="@string/title1">
<SwitchPreference
android:key="parents"
android:summaryOff="@string/do_smthng"
android:summaryOn="@string/do_smthng"
android:switchTextOff="@string/i_am_sleeping"
android:switchTextOn="@string/i_have_free_time" />
<CheckBoxPreference
android:key="baby"
android:dependency="parents"
android:title="@string/basic_habbits"
android:summaryOff="@string/play_with_parents"
android:summaryOn="@string/play_with_parents"
android:defaultValue="true" />
</PreferenceCategory>

基本上,宝宝在 sleep 的时候不能和 parent 一起玩=)

关于安卓 CheckBoxPreference : how to disable and enable other preferences on preference change,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7751525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com