gpt4 book ai didi

android - 卡片 View 阴影未显示

转载 作者:行者123 更新时间:2023-11-29 19:43:21 28 4
gpt4 key购买 nike

这是我的card_view。我已经提到了 card_view:cardElevation。但是仍然没有显示阴影。 我搜索了很多链接。他们在任何地方都提到要使用 card_view:cardElevation

<android.support.v7.widget.CardView
android:id="@+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true"
app:cardPreventCornerOverlap="false">
</android.support.v7.widget.CardView>

你能告诉我这里缺少什么吗?

最佳答案

阅读https://developer.android.com/training/material/lists-cards.html

To create a card with a shadow, use the card_view:cardElevation attribute. CardView uses real elevation and dynamic shadows on Android 5.0 (API level 21) and above and falls back to a programmatic shadow implementation on earlier versions. For more information, see Maintaining Compatibility.

更新

如果您想看到阴影,请尝试为卡片添加边距

检查 https://developer.android.com/reference/android/support/v7/widget/CardView.html

关于android - 卡片 View 阴影未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38260673/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com