Android设计支持库和材料设计向后兼容? [英] Android Design Support Library And Material Design Backwards Compatibility?

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

问题描述

我是新来的,如此忍受我!
我八九不离十困惑的新设计支持库(和怎样实现支持库),我有一两个问题:

I'm new here, so bear with me! I'm sorta confused about the new Design Support Library (and how one implements support libraries), and I had a two questions:


  • 我感到困惑支持库是如何实现的。难道是说'如果操作系统版本低于5.0版本,使用V7支持库这样简单的事情,否则我将不得不code的的替代布局(一个用于运行+5.0设备,以及一个用于运行Android的老版本的设备?)

  • 设计是否支持库的替换添加到的V7的支持库? (如果我想包括,比如说,卡在一个应用程序的小吃店,我会能够只使用设计支持库或我将不得不与V7 cardview库一起使用吗?我知道这是一个愚蠢的问题,但我只是想确认一下。)

  • I'm confused about how support libraries are implemented. Is it something as simple as saying 'if the OS version is below version 5.0, use the V7 support library', or would I have to code an 'Alternative Layout'(One for devices running +5.0, and one for devices running older version of android?)
  • Does the Design Support Library replace or add-to the V7 support libraries? (If I wanted to include, say, cards and a snack bar in an app, would I be able to just use the Design Support Library or would I have to use it along with the v7 cardview library? I know it's a stupid question, but I just want to make sure.)

非常感谢!

推荐答案

您可以使用的支持库以反向移植与最后的API(例如21)运行previous API级的旧设备引入了一些功能。

You can use the support libraries to backport some features introduced with the last api (for example 21) to old devices running a previous api level.

例如,API21推出了新的部件,该工具栏。这个小工具只能与API的设备可用于> = 21。

For example, API21 introduced a new widget, the Toolbar. This widget can be used only in device with API >=21.

随着程序兼容性 rel.21(一v7的支持库)可以使用的工具栏(注意包)来实现您的工具栏在旧设备上运行的API> = 7。

With the appcompat rel.21 (a v7 Support library) you can use the Toolbar (pay attention to the package) to implement your Toolbar in old devices running API>=7.

这可能发生,因为支持库都包含在您的APK。

This can happen because the support libraries are included in your apk.

设计支持库是增加新的功能一个新库。
它包含的意见,小吃吧,TextInputLayout,FloatingActionButton,但不包含卡。

The Design Support Library is a new library which add new features. It contains views as Snackbar, TextInputLayout, FloatingActionButton, but it doesn't contain the Card.

因此​​,使用这种依赖的设计支持库:

So use this dependency for the design support library:

compile 'com.android.support:design:22.2.0'

这依赖于使用应用程序兼容性库

This dependency to use the AppCompat library

compile 'com.android.support:appcompat-v7:22.2.0'

这依赖于官方CardView

This dependency for the official CardView

compile 'com.android.support:cardview-v7:22.2.0'

检查的官方文档获取更多信息。

Check the official doc for more info.

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

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