I'm trying to set a shadow for my button, but instead of getting shadow for the whole button I'm getting it for button's text only.
I've tried both: using xml styles
<style name="shadowed_button">
<item name="android:shadowColor">#444444</item>
<item name="android:shadowDx">1</item>
<item name="android:shadowDy">1</item>
<item name="android:shadowRadius">9</item>
</style>
and setting shadow programmatically
button.setShadowLayer(9, 1, 1, Color.rgb(44, 44, 44));
Both work identically. Does anyone know how to do this?
Shadows are drawn by the parent of the elevated view, and thus subject to standard view clipping, clipped by the parent by default. Elevation is also useful to create animations where widgets temporarily rise above the view plane when performing some action.
To do so you have to make the image of the button with shadow and place on the button as drawable.
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