android :framework层自定义theme无法取得

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android :framework层自定义theme无法取得相关的知识,希望对你有一定的参考价值。

frameworks/base/core/res/res/values/themes.xml
我尝试在里面追加了一个theme,代码如下
...
<style name="Theme.test" parent="@android:Theme" />
<style name="Theme.test.InverseBackground">
<item name="listChoiceIndicatorSingle">@android:drawable/btn_radio1</item>
</style>
...

而在APP那边,
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.test">
<item name="android:windowDisablePreview">true</item>
</style>
</resources>

但是全编译之后,我发现我的apply并没有加载我自定义的风格(MyTheme),经过反编译后我发现我在apply内定义的styles.xml被强制变为如下的代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Widget.Holo.ActionButton">
<item name="android:windowDisablePreview">true</item>
</style>
</resources>

也就是说系统没有找到Theme.test这个主题,而直接去拿了默认的Widget.Holo.ActionButton,请问有没有高手知道这是什么原因,是不是framework下面还要进行什么修改,才能让我自定义的Theme.test加到系统的主题里,可以被应用程序调用?

望高手指点,感激万分!

参考技术A 删除这个theme,然后新建.

以上是关于android :framework层自定义theme无法取得的主要内容,如果未能解决你的问题,请参考以下文章

AndroidStudio Frameworks detected: Android framework is detected in the project Configure

Binder实用指南 - 实战篇

Binder实用指南 - 实战篇

android自定义view --视差动画

android自定义view --视差动画

Android 系统编译不过了报错Try jack-diagnose,SSL error when connecting to the Jack server