gpt4 book ai didi

Android Theme 样式文件合并

转载 作者:搜寻专家 更新时间:2023-11-01 08:28:34 25 4
gpt4 key购买 nike

简而言之,我有一个多主题项目 style.xmlstyle.xml(v21) .这两个版本唯一的区别是在v21版本的每个主题中都增加了这两行:
<item name="android:navigationBarColor">?attr/colorPrimaryDark</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>

而且我没有维护两个样式文件,因为它们太熟悉了,所以有什么办法可以合并这两个样式 xml 文件,或者使 v21 扩展 style.xml当我要进行一些修改时,我只需要使用 style.xml

最佳答案

你是这个意思吗?

将它放在您的“普通”主题文件夹中

<!--Standard-->
<style name="CommonTheme" parent="Theme.AppCompat.NoActionBar">
<!--Place all common elements here-->
</style>

<!--Standard-->
<style name="AppTheme" parent="CommonTheme">

</style>

将它放在你的 V21 文件夹中

<!--V21-->
<style name="AppTheme" parent="CommonTheme">
<item name="android:navigationBarColor">?attr/colorPrimaryDark</item>
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
</style>

关于Android Theme 样式文件合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42626490/

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