更新时间:2023-12-04 22:03:58
您可以通过使用不同的风格XML的实施的风格选择。
You can implement a "style selector" by using different style XMLs.
只要定义一个名为StyleSelector或者类似的东西在/res/values/styles.xml主题:
Just define a theme named "StyleSelector" or something like that in /res/values/styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="ThemeSelector" parent="@android:style/Theme.Black">
... Your theme definitions
</style>
</resources>
然后创建一个/res/values-v11/styles.xml:
Then create a /res/values-v11/styles.xml:
<resources>
<style name="ThemeSelector" parent="@android:style/Theme.Holo">
</style>
</resources>
现在只是@风格/ ThemeSelector适用于你的主题,然后让Android做的魔力。
在较旧的Android版本,你的主题定义将被加载,在新版本与全息技术支持,你的主题将全息得出。
Now just apply your theme with "@style/ThemeSelector" and let Android do the magic. On older Android versions, your theme definition will be loaded, on newer versions with Holo-Support, your theme will be derived from Holo.