如何申请主题到< preferenceScreen> preferenceCategory>一种所述&的要素; [英] How to apply theme to <PreferenceScreen> elements of a <PreferenceCategory>

查看:116
本文介绍了如何申请主题到< preferenceScreen> preferenceCategory>一种所述&的要素;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个扩展preferenceActivity的活动。

我的主题:机器人:主题=@安卓风格/ Theme.Light.NoTitleBar.Fullscreen应用到清单文件中的应用水平

一切都越来越需要的主题,除了对preferenceCategory的preferenceScreen元素。他们仍然有默认的黑色背景。简单地说,主要preference类别屏幕具有父preference画面所得到的主题,但如果我点击任何preferenceScreens的去他们的元素preferences(EditText上等等等等),他们没有得到的主题...

任何想法,为什么这可能发生?

结构或preferences.xml是这样的:

 < preferenceCategory>

    < preferenceScreen>
        < EditText上preference>
        ...
        < / EditText上preference>
        < EditText上preference>
        ...
        < / EditText上preference>
        ...
    < / preferenceScreen>

    < preferenceScreen>
    ...
    < / preferenceScreen>

< / preferenceCategory>
 

解决方案

这在早期的Andr​​oid版本的bug(另见的 HTTP:?//$c$c.google.com/p/android/issues/detail ID = 4611

如果我没有记错的主题没有正确应用到preferenceActivity在所有的Andr​​oid 2.X版本。解决这个问题的方法之一是设置调整颜色/字体等等自己,但也有在错误报告的注释中描述的解决方法。主题应能正常工作在Android 3.0及更高版本。

I have an activity that extends PreferenceActivity.

My theme : android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" is applied to the application level in the Manifest file.

Everything is getting the desired theme except the "PreferenceScreen" elements of "PreferenceCategory". They are still having the default black background. In simple words, the main Preference Category screen which has the parent Preference Screens are getting the theme but if I click on any of the PreferenceScreens to go to their element preferences(EditText etc etc), they are not getting the theme...

Any Idea why this might be happening?

The structure or preferences.xml is something like this :

<PreferenceCategory>

    <PreferenceScreen>
        <EditTextPreference>
        ...
        </EditTextPreference>
        <EditTextPreference>
        ...
        </EditTextPreference>
        ...
    </PreferenceScreen>

    <PreferenceScreen>
    ...
    </PreferenceScreen>

</PreferenceCategory>

解决方案

It's a bug in earlier Android versions (see also http://code.google.com/p/android/issues/detail?id=4611).

If I remember correctly themes aren't properly applied to a PreferenceActivity on all Android 2.x versions. One way to fix this is to set adjust the colors/fonts etc. yourself, but there is also a workaround described in the comments of the bugreport. Themes should work properly on Android 3.0 and later.

这篇关于如何申请主题到&lt; preferenceScreen&GT; preferenceCategory&gt;一种所述&的要素;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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