[英]Android CardView shadow gets cut off
Shadows seem to cut off on some of my CardView usages.阴影似乎切断了我的一些 CardView 用法。 Any idea why?
知道为什么吗? looks like removing the padding on the parent resolves the issue, but I do want the padding.
看起来删除父级上的填充可以解决问题,但我确实想要填充。 And I don't want to use margin on the inner card, because there are other views aligned and I prefer having the padding set on the parent to apply to all children
而且我不想在内卡上使用边距,因为还有其他视图对齐,我更喜欢在父级上设置填充以应用于所有子级
Any solutions?有什么解决办法吗?
layout布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_spacing"
android:layout_marginLeft="@dimen/standard_spacing"
android:layout_marginRight="@dimen/standard_spacing"
android:layout_marginBottom="@dimen/smaller_spacing"
app:cardCornerRadius="@dimen/standard_card_corner_radius"
app:cardElevation="10dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/standard_spacing">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="@color/light_gray_background"
android:minHeight="40dp"
app:cardElevation="5dp"
app:cardCornerRadius="@dimen/standard_card_corner_radius" >
</androidx.cardview.widget.CardView>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
add添加
android:clipToPadding="false"
to LinearLayout到线性布局
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.