【问题标题】:Android Studio CardView is always transparent [duplicate]Android Studio CardView 总是透明的[重复]
【发布时间】:2020-06-18 21:48:58
【问题描述】:

我正在尝试使用 Cardview,但它不显示背景,它总是透明的。 我尝试使用 cardBackgroundColor 更改背景,但它不起作用,它保持透明。 我怎样才能改变背景? enter image description here

【问题讨论】:

  • 用文字写代码,不要用图片写代码,对你有帮助会更容易
  • 您可能在布局的根 xml 标记中没有 xmlns:app="http://schemas.android.com/apk/res-auto"

标签: android android-studio android-cardview


【解决方案1】:

我怀疑它没有选择cardBackgroundColor,因为您没有app 命名空间。确保在布局的顶部容器元素中有 app 命名空间

xmlns:app="http://schemas.android.com/apk/res-auto"

【讨论】:

    猜你喜欢
    • 2018-12-20
    • 1970-01-01
    • 2020-10-26
    • 2019-11-18
    • 2017-06-18
    • 2015-10-15
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多