3 ms·
That's why you ask your designer to give you an elevation value instead of a blur radius and offset. If you really want a shadow with arbitrary color/radius/off
by grishka 3y ago
That's why you ask your designer to give you an elevation value instead of a blur radius and offset. If you really want a shadow with arbitrary color/radius/offset like CSS box-shadow, you have to use paint.setShadowLayer() in a software-rendered canvas (a bitmap or a software layer). Exception is that such shadows for text can be rendered with hardware acceleration.
- burnedtoast 3y agoYeah, that's normal practice and usually works OK. But then sometimes it happens that the given elevation value give a shadow much weaker than in the design tool. Especially for things like a bottom toolbar where the top of the shadow is close to the bottom of the screen and supposed to visually separate the toolbar from content. Another toolbar using the same elevation in another place on the screen may look fine. So when QA say that the shadow is too weak, you have to tell your designer this and they have to come up with something different, or you have to increase elevation to compensate, or fall back to a pre-rendered 9-patch, or something else... As i said, annoying :\