I'm trying to provide elevation
to the corners of cardview
. my requirement is elevation
should n't effect at the middle of cardview
. it should effect only corners like image shown below.
As shown in image, at the middle of the cardview
elevation
should be zero at corners there should be some elevation
(for example:
elevation:4dp
)
Here is the code i tried so far
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@null"
android:gravity="center"
card_view:cardBackgroundColor="@android:color/white"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="3dp">
Try setting
card_view:cardUseCompatPadding="true"
So your xml should look like: