Creating a button with custom color shadow


#1

I want to create a button with custom color shadow. Is it possible to do in android?


#2

If I had to guess, my answer is no. As on Android 5.0+ the drop shadow is supplied by the system. AFAIK, the system tries to emulate real-world shadows, and in the real world, shadows do not adopt the color of the object casting the shadow.

There is nothing stopping you from blocking the built-in shadows and baking a colorized drop shadow into the background of your button, though I do not know how you would do to that in a way that handles resizing well.

It is possible that there are other techniques that you might use, but I do not know of any.

Sorry!


#3

FWIW, this tweet indicates that there is a way to tint the drop shadow on Android 9.0, which also implies that it is not supported directly on older Android versions.


#4

Awesome…thanks Finally seeing some good work!