Question - difference between shadowElevation and shadowTranslationZ?
Opened this issue · 2 comments
I've been playing around with the values in my app, and also looked at your source code, but I can't quite figure out what the difference is. I'm assuming shadowElevation is how "high" the shadow should be, e.g., what the elevation is of the material it's cast upon? While shadowTranslationZ is how "high" the item in the container is? I'm not sure – shadowElevation is not used in your sample!
Likewise for how much margin is required - you put 16dp for everything in the examples, but how can we calculate the minimum margin required for each shadow size?
Thank you so much for this library, I hope a short guide in the README would as helpful to others!
Hi. The meaning of the words "elevation" and "translation" are the same with Android frameworks.
The Z value for a view has two components:
Elevation: The static component.
Translation: The dynamic component used for animations.
Z = elevation + translationZ
ref.) https://developer.android.com/training/material/shadows-clipping.html
Likewise for how much margin is required - you put 16dp for everything in the examples, but how can we calculate the minimum margin required for each shadow size?
Sorry, I am not sure that. Because the shadow's position and size are affected by the following factors.
- Z position (elevation + translation)
- X and Y position in the window (it depends on device screen size!)
Thanks, this has helped 😄