Layer List and Inset Drawables
The stock Android buttons you saw in the initial version of your app had a shadow effect. Unfortunately, shape drawables have no shadow property. But you can make the shadow effect yourself using two other XML drawable types: layer list drawables and inset drawables.
Here is how you will do it. First, you will create a shadow with the same shape as your current button drawable. Then you will combine it with the current button using layer-list, and offset the bottom edge of the button a tad using inset so that the shadow becomes visible underneath.
Create a new XML file in res/drawable/. Name it button_shape_shadowed.xml and make its root element layer-list.
Listing 25.8 Normal button shadows (drawable/button_shape_shadowed.xml ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access