[英]Android Card View Shadow in each side
I hope this works for you.我希望这对你有用。 You can try using the app:cardElevation="8dp"
attribute and change the value to suit your needs.您可以尝试使用app:cardElevation="8dp"
属性并更改值以满足您的需要。 Remember to add this attribute the parent layout first though xmlns:app="http://schemas.android.com/apk/res-auto"
请记住先将此属性添加到父布局中,尽管xmlns:app="http://schemas.android.com/apk/res-auto"
example below下面的例子
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"
app:cardCornerRadius="10dp"
app:cardElevation="8dp">
</androidx.cardview.widget.CardView>
</RelativeLayout>
As for the rounded corners you can use the app:cardCornerRadius="10dp"
and adjust the value to suit your needs.至于圆角,您可以使用app:cardCornerRadius="10dp"
并调整值以满足您的需要。
The key is use android:elevation="@dimen/_4sdp".关键是使用 android:elevation="@dimen/_4sdp"。
<androidx.cardview.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_4sdp"
android:background="@drawable/bg_white"
android:elevation="@dimen/_4sdp"
app:cardCornerRadius="@dimen/_8sdp">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.