【问题标题】:CardView background set using cardBackgroundColor covers shadowCardView 背景设置使用 cardBackgroundColor 覆盖阴影
【发布时间】:2021-10-01 08:21:00
【问题描述】:

我正在尝试设置 MaterialCardView 被选中时的背景颜色。背景颜色似乎也会影响阴影区域。 当颜色为纯色时,这不太明显,当背景颜色部分半透明时,它变得清晰。

我发现了这个问题(Card View background color affects shadow color),作者可以用纯色作为背景,但我不行。

有没有办法只在卡片内部应用背景颜色而不影响阴影区域?

【问题讨论】:

  • 我用卡片视图不多,但是添加另一个布局/视图match_parent并将其用作背景如何?
  • 您可以在我引用的链接中找到相同的方法。问题是 chlidview 没有圆边,看起来很丑。

标签: android android-cardview


【解决方案1】:

在 XML 中使用背景色

android:backgroundTint

【讨论】:

  • 它也会产生与设置cardBackgroundColor属性相同的效果
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多