Android的:如何处理主题化老年SDK的 [英] Android: How to handle theming for older SDK's

查看:210
本文介绍了Android的:如何处理主题化老年SDK的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,是minSDK 10,目标的14.我喜欢使用Light.Holo主题(如果可用的设备 - 而回落到轻的主题为老年人的设备)。有没有一种方法,我可以做到这一点呢?

I have an app that is minSDK 10, target's 14. I'd love to use the Light.Holo Theme (if available for device--and falls back to light theme for older device). Is there a way I can do this this?

当你的目标14似乎默认为Dark.Holo,但是当我尝试添加任何其他主题,它会覆盖它,并使它看起来较旧的较新设备上。

It seems it defaults to Dark.Holo when you target 14, but when I try to add any other theme, it overwrites it and makes it look older on newer devices.

推荐答案

您需要提供不同的风格为平台,以确保正确的样式将在运行时被发现。

You need to provide separate styles for both platforms to ensure that the correct style will be found at runtime.

在您的RES /价值/ styles.xml文件,创建以下样式:

In your res/values/styles.xml file, create the following style:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.MyTheme" parent="@android:style/Theme.Light" />
</resources>

在您的RES /值-V11 / styles.xml文件,创建以下样式:

In your res/values-v11/styles.xml file, create the following style:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.MyTheme" parent="@android:style/Theme.Holo.Light" />
</resources>

在您的Andr​​oidManifest.xml文件,用于应用程序的主题,下面一行:

In your AndroidManifest.xml file, use the following line for your application's theme:

android:theme="@style/Theme.MyTheme"

这篇关于Android的:如何处理主题化老年SDK的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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