preferenceScreen安卓汇总更新! [英] PreferenceScreen android:summary update !

查看:120
本文介绍了preferenceScreen安卓汇总更新!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我有一个 preferenceScreen 母公司,拥有3个复选框preferences 作为孩子。

In my android application I have a PreferenceScreen parent that has 3 CheckBoxPreferences as children.

当我点击父preferenceScreen,和3复选框的显示方式,我选择其中之一,并在preference.On preferenceChangeListener asociated与复选框我设置了家长的preferenceScreen与总结:

When I click the parent preferenceScreen, and the 3 checkboxes are displayed, I select one of them, and in the Preference.OnPreferenceChangeListener asociated with the checkboxes I set the parent's preferenceScreen summary with:

Parent.setSummary("string depending on the selection")

的事情是,当我回到了父母,这是总结不更新,即使内部的价值也相应改为设置好的价值。

The thing is that when I return to the parent, it's summary is not updated, even if internally the value has correspondingly changed to the value setted.

有没有人对此行为的任何想法?

Has anyone any idea regarding this behavior?

推荐答案

使用

Parent.setSummary("string depending on the selection");
((BaseAdapter)getPreferenceScreen().getRootAdapter()).notifyDataSetChanged();

就像一个魅力,可以考虑使用的地方,你改变了总结。

works like a charm and can be used regardless the place you change the summary.

这篇关于preferenceScreen安卓汇总更新!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆