Android的全息主题向后兼容 [英] Android Holo themes with backwards compatibility

查看:105
本文介绍了Android的全息主题向后兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立Android应用程序与支持安卓的minSdkVersion =7机器人:targetSdkVersion =15。我用我的自定义主题继承Android的默认主题。
所以现在我想改变整个应用程序的主题,全息theme.Can任何一个可以帮助我在此。
感谢名单

I have built android app with supporting android:minSdkVersion="7" android:targetSdkVersion="15".I use my customized theme inheriting Android default theme. so now i want to change whole application theme to Holo theme.Can any one help me on this. Thanx

推荐答案

您可以通过使用不同的风格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做的魔力。
在较旧的Andr​​oid版本,你的主题定义将被加载,在新版本与全息技术支持,你的主题将全息得出。

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.

这篇关于Android的全息主题向后兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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