News for hackers. Stuff that matters.

Android Toolbar dropshadow on all API levels

How can you get a Toolbar dropshadow on all API levels on Android? I created a repo to demonstrate this exact issue : https://github.com/lawloretienne/ToolbarExample I only see a dropshadow on API level 21+ .
( 2 comments | 2 points | on HN )
Re:Android Toolbar dropshadow on all API levels by smartician on Thursday June 25, 2015 @08:19PM (#9781772)
There are a few topics on StackOverflow where this gets answered. The short answer: Toolbar is using the "elevation" property, which only Lollipop and above support natively. A simple solution is to manually add the shadow as a drawable to the Toolbar, and hide that when running on SDK 21+.
Re:Android Toolbar dropshadow on all API levels by lawlorslaw on Thursday June 25, 2015 @08:23PM (#9781788)
Ya I was hoping that was not the case anymore. I have a temporary work around that adds a dropshadow view on the layout file while the layout-v21 file does NOT have the dropshadow view. Which seems to work, but I wanted to see if there is a better "Best Practice".