Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does elevation not work within Android Home Screen Widgets?

Tried all sorts of different ways to do this but not matter what view I apply an elevation to (such as android:elevation="10dp") it does not render correctly on a Home Screen Widget.

Is this a known limitation, that home screen widgets do not support elevation. I am running this on an Android L device so its should not be a compatibility issue.

If this is impossible I figure I could use 9-patch or layer-list drawable to achieve a similar but not as good effect.

like image 494
w.donahue Avatar asked Feb 11 '16 00:02

w.donahue


1 Answers

I've played with all widgets I have on my phone (both with Nova Launcher and Nexus 5 stock launcher, which is Google) and none of them have this feature, even Google apps (excluding Google Now!).

I've added app:elevation="10dp" on my widget and I think that it is not possible to have this feature on Widget directly, without playing with code and fantasy.

If you really want a widget that include elevation design, just "copy" the style of Google Now widget.

enter image description here

I suppose that they have a transparent layout (the black parts on image) wich contains another layout (grey) with elevation and grid filled with CardView with elevation too.

Let me know if you want an example code.

like image 55
JJ86 Avatar answered Sep 20 '22 05:09

JJ86