Reputation: 1
I have a ui design. I should to make some xml file with custom shadow color.
I used to carbon library but it not work very well
I need to create shadow like this
Upvotes: 0
Views: 1231
Reputation: 101
This should work for Android version 28 or higher.
In your xml layout, include this in your CardView.
android:outlineAmbientShadowColor="<yourColor>"
android:outlineSpotShadowColor="<yourColor>"
You can do the same in code by doing this:
mCardView.setOutlineAmbientShadowColor(ContextCompat.getColor(getContext(), R.color.color_blue));
mCardView.setOutlineSpotShadowColor(ContextCompat.getColor(getContext(), R.color.colour_blue));
Upvotes: 1