我在Android Studio中创建了一个新的应用程序。compileSdkVersion是23。有人知道为什么现在要找到RecyclerView和CardView吗?(不通过java代码,也不在布局xml文件中)
我肯定不是唯一遇到过这个问题的人。
下面是我的app模块的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test.testapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}发布于 2015-10-14 15:20:29
我也有同样的问题,我设法解决了这个问题,我迁移到23.0.1,并在CardView中添加了android:elevation和一点边际。
似乎在API 21之前,它是通过编程来模拟阴影的,但在新的版本中,你必须添加它。
发布于 2016-09-12 17:19:14
你可以通过修改build.gradle(模块:app) follow来解决这个问题。依赖关系{
编译fileTree(包含:'*.jar',目录:'libs')
testCompile 'junit:junit:4.12‘
编译'com.android.support:cardview-v7:23.0.0'
}
发布于 2016-09-12 17:24:46
您缺少对回收器视图和卡视图支持库的支持。添加这两行代码,同步项目,您将能够在java代码和xml中找到CardView和RecyclerView。
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'https://stackoverflow.com/questions/33038578
复制相似问题