I was using cardview, but the problem is elevation not showing in lollipop and higher versions. please suggest me.Here is my code.
<android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/verify_card" android:layout_weight="1" card_view:cardBackgroundColor="@android:color/white" card_view:cardElevation="2sp" card_view:cardUseCompatPadding="true" />
Thanks in advance.
CardView uses elevation property on Lollipop for shadows and falls back to a custom emulated shadow implementation on older platforms. Due to expensive nature of rounded corner clipping, on platforms before Lollipop, CardView does not clip its children that intersect with rounded corners.
Customized CardView First, add a CardView dependency to the application-level build. gradle file. Then create a drawable background for the cards. For that, create a new drawable resource file inside the drawable folder.
CardView is a new widget in Android that can be used to display any sort of data by providing a rounded corner layout along with a specific elevation. CardView is the view that can display views on top of each other. The main usage of CardView is that it helps to give a rich feel and look to the UI design.
this worked for me.
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto"
total code is:
<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_margin="8dp" android:id="@+id/card_griditem" android:layout_height="match_parent" card_view:cardUseCompatPadding="true" card_view:cardElevation="4dp" card_view:cardCornerRadius="3dp">`
Make sure you have set android:hardwareAccelerated="false"
as true in Manifest. By setting it to false your application will not able to use GPU and can't make some 2D designs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With