Java 错误:(4,42)未找到与给定名称匹配的资源(位于';cardBackgroundColor';处,值为';?android:attr/colorBackgroundFloating';)
大家好 我可以知道为什么我的recycler cardview邮件日志显示此错误吗? 以前有人遇到过这个错误吗Java 错误:(4,42)未找到与给定名称匹配的资源(位于';cardBackgroundColor';处,值为';?android:attr/colorBackgroundFloating';),java,android,android-studio,Java,Android,Android Studio,大家好 我可以知道为什么我的recycler cardview邮件日志显示此错误吗? 以前有人遇到过这个错误吗 D:\New folder\DrawerWithSwipeTabs\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml Error:(4, 42) No resource found that matches the given name (at 'cardBackgroundColor' with v
D:\New folder\DrawerWithSwipeTabs\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(4, 42) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:(4, 42) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
它会自动弹出到D:\New folder\drawerwithswipatebs\app\build\mediates\res\merged\debug\values-v23\values-v23.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CardView" parent="Base.CardView">
<item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
</style>
</resources>
build.gradle(模块:应用程序)
sdk版本22中未引入此父类。
要实现这一点,您需要将minSdk版本和库版本更改为sdk版本23
像这样的事
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.androidbelieve.drawerwithswipetabs"
minSdkVersion 15
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.androidbelieve.drawerwithswipetabs"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
}
parent="Base.CardView"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.androidbelieve.drawerwithswipetabs"
minSdkVersion 15
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
}