How to change shadow color and angle in CardView ? I've put cardview_shadow_start_color and cardview_shadow_end_color into colors.xml but no colors changes... Txs !
Use Fake Shadow. xml ) in the parent layout which is looking like a shadow. You can replace FF46A9 in shadow. xml to change the color of shadow. Also android:backgroundTint="@color/colorShadow" works but you have to adjust colors alpha in shadow.
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.
Note that the card_view:cardElevation is used to determine the size and softness of the shadow so as to realistically depict the depth. These properties can be set programmatically as well: CardView card = ... card.
There's no way to change shadow color and angle in the official Android framework. The color is always black and the angle is generated automatically using view's position. Moreover, on older platforms CardView's shadow is a completly different thing than on Lollipop, so the angle won't work at all.
For colored shadows you can use a library called Carbon. See this answer: Android change Material elevation shadow color
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