如何保持向后兼容性,同时利用Android的API 15级? [英] How to maintain backwards compatibility while utilising Android API Level 15?

查看:97
本文介绍了如何保持向后兼容性,同时利用Android的API 15级?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

冰淇淋三明治推出了很多全新的UI设计元素,但市场渗透率仍然仅为4%左右。如果一个人想满足未来的应用程序,并利用一些与蜂窝/冰淇淋三明治推出的设计元素,如操作栏,配色方案等,这将是最好的方式,以确保您能够向下的一些点点兼容性如何?

Ice cream sandwich introduced a lot of new UI design elements but market penetration is still only 4% or so. If one wanted to future-proof their application and utilise some of the design elements introduced with Honeycomb/Ice Cream Sandwich, such as the action bar, the colour scheme etc., what would be the best way to ensure you maintain some modicum of backwards compatibility?

推荐答案

虽然我同意@Ollie C,我觉得还有其他选择添加其他比只使用了动作条福尔摩斯库,而说这句话的我积极参与ABS社区,并同意它是<打击> fantasmagoricly 真正有用的,并包含所有UI资产可能会需要。

While I agree with @Ollie C, I think there are other options to add other than just using the Actionbar Sherlock library, while saying this I actively participate in the ABS community and agree it is fantasmagoricly really useful and contains all the UI assets will probably need.

您可以看看UI组件的优雅降级回通过API的水平。因此,例如:

You could look at graceful degradation of UI components back through the API levels. So for example:

您可以创建在文件夹,并设置样式像这样

You could create in the values folder and set the style like so

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

然后为Android 3.0+设备,创建值-V11 文件夹:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
        <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

和为4.0+设备,创建值-V14

And for 4.0+ devices, create values-v14:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
        <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

REF:<一href="http://android-developers.blogspot.co.uk/2012/01/holo-everywhere.html">http://android-developers.blogspot.co.uk/2012/01/holo-everywhere.html, <一href="http://stackoverflow.com/questions/9681648/how-to-use-holo-light-theme-and-fall-back-to-light-on-$p$p-honeycomb-devices">How使用Holo.Light主题,回落到'光'的pre-蜂窝设备?

也有这个项目:<一href="https://github.com/ChristopheVersieux/HoloEverywhere">https://github.com/ChristopheVersieux/HoloEverywhere它试图把全息主题。

There is also this project: https://github.com/ChristopheVersieux/HoloEverywhere that it attempting to bring the holo theme.

最后,谷歌鼓励开发者包括来自SDK UI组件,以帮助落后的兼容性问题,而不是直接从Android OS引用它们。虽然这不是你的问题,它确实有助于提供一定的一致性。

Finally; Google encourage the developers to include UI components from the SDK to help with the backward compatibility issue, rather than referencing them directly from the Android OS. While this is not your question, it does help provide some consistency.

这篇关于如何保持向后兼容性,同时利用Android的API 15级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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