我使用的是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是这样的:
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"
}发布于 2015-07-28 16:24:27
首先,更新您的依赖项,如下所示:
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就知道了
https://stackoverflow.com/questions/31670421
复制相似问题