开发者社区> 问答> 正文

Cardview在Android Studio 3.5.1中不显示

我在旧的android studio版本3.3.1上尝试了cardview库,代码运行正常。模拟器显示正确的图像。但是,我切换到了新版本3.5,CardView中没有显示任何内容,甚至没有文本视图。

xml代码:

Gradle: dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'com.android.support:cardview-v7:28.0.0'

}

展开
收起
小六码奴 2019-10-21 17:49:27 9702 0
1 条回答
写回答
取消 提交回答
  • 不能同时使用support库和andriodx库。

    更改

    implementation 'com.android.support:cardview-v7:28.0.0' 至

    implementation 'androidx.cardview:cardview:1.0.0' 在你的布局/代码中使用androidx.cardview.widget.Card

    2019-10-21 18:09:34
    赞同 1 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载