
您可以通过API级别查看UI组件的优雅退化.所以例如:
您可以在values文件夹中创建并设置样式
<?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设备,创建值-14:
<?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:http://android-developers.blogspot.co.uk/2012/01/holo-everywhere.html,How to use Holo.Light theme,and fall back to ‘Light’ on pre-honeycomb devices?
还有这个项目:https://github.com/ChristopheVersieux/HoloEverywhere它试图带来全息主题.
最后; Google鼓励开发人员从SDK中添加UI组件来帮助解决向后兼容性问题,而不是直接从AndroID *** 作系统引用它们.虽然这不是你的问题,但它确实有助于提供一些一致性.
总结以上是内存溢出为你收集整理的使用Android API Level 15时如何保持向后兼容性?全部内容,希望文章能够帮你解决使用Android API Level 15时如何保持向后兼容性?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)