首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android 5之前的设备中使用材料设计

在android 5之前的设备中使用材料设计
EN

Stack Overflow用户
提问于 2015-07-28 15:52:49
回答 1查看 771关注 0票数 1

我使用的是android studio,我想使用API低于21的素材设计功能。首先,我读到了这些问题:

how to use material design features in api lower than 21 in eclipse?

I want Material Design in Pre 5.0 device in eclipse

Android Design Support Library And Material Design Backwards Compatibility?

我还读到了这些:

https://developer.android.com/training/material/compatibility.html

https://developer.android.com/tools/support-library/features.html#v7-appcompat

另外,我使用本教程创建了一个兼容的材料设计项目:

http://www.androidhive.info/2015/04/android-getting-started-with-material-design/

我添加了这个库: com.android.support:appcompat-v7:21.0.0,我使用了像上一个链接一样的材料主题,但我在我的android 4.2.2中看不到任何材料功能。据我从google developer了解到,它使用兼容性来显示API 21中的材料特征,并且它在android 21以下的版本中仍然可以在没有材料特征的情况下工作。那么我如何在低于21版本的android上使用材质功能呢?

我的gradle是这样的:

代码语言:javascript
复制
    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "test.parsoa.com.newmaterial"
        minSdkVersion 17
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:21.0.0"
}
EN

回答 1

Stack Overflow用户

发布于 2015-07-28 16:24:27

首先,更新您的依赖项,如下所示:

代码语言:javascript
复制
dependencies {
    compile "com.android.support:appcompat-v7:22.2.1"
    compile 'com.android.support:design:22.2.1'  // with this dependency you can use material design components pre api 21 
}

看看http://android-developers.blogspot.de/2015/05/android-design-support-library.html就知道了

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31670421

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档