gpt4 book ai didi

android - 根据选中状态更改 CheckBoxPreference 摘要

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:25:23 25 4
gpt4 key购买 nike

我正在尝试创建一个应用程序,其中首选项摘要会根据 CheckBoxPreference 的选中状态发生变化。

我不太确定如何查询首选项,因为旧的 isChecked() 将不起作用。

最佳答案

如果您只在偏好布局中使用 android:summaryOffandroid:summaryOn 会简单得多。无需代码。例如:

<CheckBoxPreference
android:enabled="true"
android:key="alerts"
android:title="Alerts"

android:summaryOn="You will get notified when something interesting happens"
android:summaryOff="You will not be notified"
/>

参见:http://developer.android.com/reference/android/preference/CheckBoxPreference.html

关于android - 根据选中状态更改 CheckBoxPreference 摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11739244/

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