Default action bar elevation

2019-03-10 16:27发布

问题:

I want to use an elevation in a custom layout element and I want to set in XML the value of that element using the default action bar elevation value. I can't find a way to get it in XML and I'd like to avoid to call getElevation() in code. Any tips?

回答1:

Default value is 8dp, create dimen with this value and use on whole project, I got it from sources, but the material design guidelines state the action bar elevation should be 4dp.



回答2:

The standard elevation of the app bar is 4dp according to material design spec. Here is the link: https://material.io/guidelines/material-design/elevation-shadows.html#elevation-shadows-shadows



回答3:

Here is the official resource available for the elevations.