I am a beginner in android and has created an app which has a button,I am using a png background in that android button as the button's background and wants to add a shadow to it using.Should I go with elevation technique or using the corner coloring technique. Please guide me how to do it? Thanks
Asked
Active
Viewed 163 times
0
-
Possible duplicate of [How to provide shadow to Button](https://stackoverflow.com/questions/15333529/how-to-provide-shadow-to-button) – dustinos3 Nov 20 '18 at 18:50
-
[How to provide shadow to Button](https://stackoverflow.com/questions/15333529/how-to-provide-shadow-to-button) – Nero Nov 20 '18 at 18:50
1 Answers
0
For getting shadow effect on your button or views add the line android:elevation="8dp"
on your button(view) at layout file. Since you are new on android don't forget to search before posting a question.
Yours sincerely
Edited: for enabling the elevation parameter of the button you should also disable stateListAnimator
property of the button by adding android:stateListAnimator="@null"
to your button.

Seymur Mammadli
- 1,724
- 15
- 13
-
i want lighter color shadow like white shadow on black background – Vijay Tiwari Nov 21 '18 at 15:24
-
-
Colored shadows are not supported natively until Android 9.0, so to get that you need to make shadows using gradients, background graphics or use a 3rd party library, like Carbon (https://github.com/ZieIony/Carbon) – Zielony Nov 22 '18 at 18:41