ZieIony / Carbon

Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Home Page:https://androidreclib.wordpress.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shadow is not realistic when widget load image background

opened this issue · comments

Hello, Zielony, I don't know why the shadow has a light region between the shadow and the edge of the view, things like this. I test it on my Sumsung Galaxy S5, Android 4.4. I think it is because MaterialShapeDrawable's internal is transparent, only it's outline has shadow. So when MaterialShapeDrawable offset by z/2, the transparent part is showed out. But when the background is white, the shadow looks realistic, it is so strange, can you fix this bug?

It's not a bug, but an optical illusion. The shadow is always correct and there's no transparent inside. Your brain perceives this part of the shadow as lighter, because the button is dark and saturated. I checked it using a bitmap editor application and the shadow is working as intended.

On Android API 21+ shadows don't have that illusion, because the drawing technique is different and there's no gray inside, but a gradient.