【发布时间】:2012-02-20 19:12:19
【问题描述】:
This 非常适合静态地做一次。
但是,如果我有字体颜色偏好,并且我希望偏好屏幕本身根据它更新呢?
【问题讨论】:
标签: android
This 非常适合静态地做一次。
但是,如果我有字体颜色偏好,并且我希望偏好屏幕本身根据它更新呢?
【问题讨论】:
标签: android
使用来自this 答案的信息,您可以尝试使用SpannableString 对象并以这种方式设置颜色。该答案的示例:
Spannable summary = new SpannableString ("Currently This Color");
summary.setSpan( new ForgroundColorSpan(color), 0, summary.length(), 0 );
preference.setSummary(summary);
【讨论】:
new ForegroundColorSpan(getResources().getColor(android.R.color.holo_red_dark))
看看我对此的回答:Android PreferenceScreen title in two lines。
添加这个:
if (textView != null) {
textView.setTextColor(textView.getContext().getResources().getColor(R.color.blue));
}
【讨论】: