Reputation: 2551
Many of the Material Design UIs if not all are dependent on drop shadows. But sadly the elevation attribute is only present on Lollipop devices. So how to create a single consistent UI for your application if something as simple as drop shadows is not available on pre lollipop build versions?
There are of course some workarounds such as creating two versions of each layout, using nine patch drawables, using CardView, etc. But they all have certain problems:
So what is the solution to creating Material Design UIs that work on both Lollipop as well as pre Lollipop devices?
Upvotes: 2
Views: 360
Reputation: 12378
Make use of android support libraries
http://developer.android.com/tools/support-library/features.html#v4-appcompat
Upvotes: -1
Reputation: 16537
It might not be the ideal solution, but for me using compatibility libraries for all Android versions works pretty well. I own a Galaxy S with Android Gingerbread, so it's really old and certainly doesn't support shadows and ripples. So I wrote a library backporting all things I needed. Rendering realtime shadows for arbitrary shapes is possible since Cupcake (or Froyo - I'm not sure). Ripples are very easy to implement. So it's like this:
One of the problems is that there's no that new rendering thread, so for example the ripple animation lags when an Activity changes.
If you'd like to know more about my approach, check out my blog and github. https://androidreclib.wordpress.com/ https://github.com/ZieIony/Carbon
Upvotes: 1