[英]How to make cardview show only bottom shadow
i use following code:我使用以下代码:
<android.support.v7.widget.CardView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="true"
app:cardElevation="4dp">
<TextView android:text="in card view" android:layout_width="match_parent" android:layout_height="wrap_content"/>
</android.support.v7.widget.CardView>
the screenshot is:屏幕截图是:
how to make only bottom show shadow?如何只让底部显示阴影?
If you want a linear shadow, try this:如果你想要一个线性阴影,试试这个:
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@drawable/down_shadow"
/>
down_shadow.xml: down_shadow.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<gradient
android:angle="-90"
android:endColor="#EEEEEE"
android:startColor="#FFFFFF"
/>
</shape>
See also different articles for manual setting of shadows like this: https://medium.com/@ArmanSo/take-control-of-views-shadow-android-c6b35ba573e9 .另请参阅不同的文章,了解手动设置阴影,如下所示: https : //medium.com/@ArmanSo/take-control-of-views-shadow-android-c6b35ba573e9 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.