【问题标题】:Using material design in pre 5 android devices在前 5 个安卓设备中使用材料设计
【发布时间】:2015-07-28 07:52:48
【问题描述】:

我使用 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 中看不到任何材料功能。正如我从谷歌开发人员那里发现的那样,它使用兼容性来显示 API 21 中的材料特征,并且它仍然可以在低于 21 的 android 中没有材料特征的情况下工作。 那么对于低于 21 的 android 怎么使用材质特性呢?

我的毕业典礼是这样的:

    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"
}

【问题讨论】:

  • 你的build.gradle是什么样的?

标签: android compatibility material-design


【解决方案1】:

首先更新你的依赖,比如:

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

【讨论】:

  • 它给出了这样的错误 > 无法解析配置“:app:_debugCompile”的所有依赖项。 > 找不到 com.android.support:design:22.2.1。我也应该下载这个库吗?
  • 使用 sdk manager 将您的 sdk 更新到最新版本,然后将您的 compileSdkVersion 更新到 22 buildToolsVersion 到 "22.0.1" 和 targetSdkVersion 22
猜你喜欢
  • 1970-01-01
  • 2015-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多