支持Android的材料设计 [英] Supporting Android material design

查看:123
本文介绍了支持Android的材料设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在重新设计我们的Andr​​oid应用程序,问题上升考虑到即将推出的Andr​​oid大号平台,其材质风格:什么是支持旧设备的方法是什么?请问这个新的设计是对4.x的设备是否可以接受?

We're redesigning our android app and a question rises considering the upcoming Android L platform with its material style: what are the ways of supporting older devices? Will this new design be acceptable on 4.x devices?

推荐答案

根据 Android的材料设计的兼容性文档

我要在这里老调重弹的柜面材料的链接被取下来,其中最有可能将在不久的将来。

I'm going to rehash the material here incase the link gets taken down, which most likely it will be in the near future.

有关的材料主题

该材料的主题是仅在Android大号开发者提供   preVIEW。要配置您的应用程序使用的设备材料主题   运行Android大号开发preVIEW和设备上的旧主题   运行Android的早期版本:

The material theme is only available in the Android L Developer Preview. To configure your app to use the material theme on devices running the Android L Developer Preview and an older theme on devices running earlier versions of Android:

在定义一个主题,继承了从旧的主题(如全息)   RES /价值/ styles.xml。定义一个主题与继承相同的名字   从RES /值-V21 / styles.xml材料的主题。设置此主题   为您的应用程序的主题在清单文件。

Define a theme that inherits from an older theme (like Holo) in res/values/styles.xml. Define a theme with the same name that inherits from the material theme in res/values-v21/styles.xml. Set this theme as your app's theme in the manifest file.

至于布局

如果你根据材料设计,设计布局   准则并没有使用任何新的XML属性从Android大号   开发preVIEW,他们将在Android上的previous版本。   否则,您可以提供另一种布局。您还可以提供   替代布局以自定义您的应用程序看起来早先   Android的版本。

If the layouts that you design according to the material design guidelines do not use any of the new XML attributes from the Android L Developer Preview, they will work on previous versions of Android. Otherwise, you can provide alternative layouts. You can also provide alternative layouts to customize how your app looks on earlier versions of Android.

创建您的布局文件里为Android大号开发preVIEW   RES /布局-V21 /和你选择的布局文件的早期版本   Android的内部RES /布局/的。替代布局具有相同的文件   名字。

Create your layout files for the Android L Developer Preview inside res/layout-v21/ and your alternative layout files for earlier versions of Android inside res/layout/. Alternative layouts have the same file name.

要避免code复制,里面定义你的风格RES /价值/   和修改RES样式/值-V21 /新的API。

To avoid duplication of code, define your styles inside res/values/ and modify the styles in res/values-v21/ for the new APIs.

有关UI组件

在RecyclerView和CardView部件都包含在Android大号   开发preVIEW支持库,所以它们在早期可用   安卓的这些限制的版本:

The RecyclerView and CardView widgets are included in the Android L Developer Preview Support Library, so they are available in earlier versions of Android with these limitations:

CardView回落到一个纲领性的影子实现使用   额外填充。 CardView不夹及其子视图   相交带有圆角。这些限制并不适用于   Android的大号开发preVIEW。

CardView falls back to a programmatic shadow implementation using additional padding. CardView does not clip its children views that intersect with rounded corners. These limitations do not apply to the Android L Developer Preview.

和最后的动画

下面的新API只在Android大号开发者提供   preVIEW:

The following new APIs are only available in the Android L Developer Preview:

活动的过渡,触控反馈,显示动画,基于路径的   动画。为了$与早期的Andr​​oid verisons p $ pserve兼容性,   检查系统版本,在运行时调用这些API之前。

Activity transitions, Touch feedback, Reveal animations, Path-based animations. To preserve compatibility with earlier verisons of Android, check the system version at runtime before you invoke these APIs.

这篇关于支持Android的材料设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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