BottomBar icon indicating copy to clipboard operation
BottomBar copied to clipboard

Elevation

Open hirosz opened this issue 8 years ago • 2 comments

Elevation attribute doesn't work

hirosz avatar Jul 25 '17 14:07 hirosz

This might be related. I found a bug in the below code snippet.

@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
    private void init21(Context context) {
        if (showShadow) {
            shadowElevation = getElevation();
            shadowElevation = shadowElevation > 0
                    ? shadowElevation
                    : getResources().getDimensionPixelSize(R.dimen.bb_default_elevation);
            setElevation(MiscUtils.dpToPixel(context, shadowElevation));
            setOutlineProvider(ViewOutlineProvider.BOUNDS);
        }
    }

If getResources().getDimensionPixelSize(R.dimen.bb_default_elevation) is retrieved it is automatically resolved in pixels. But in setElevation(MiscUtils.dpToPixel(context, shadowElevation)); it the DP to PX convertion is applied a second time, which in most cases leads to a too high value.

My observation on Lollipop+ devices however is, that I cannot see any elevation shadow or just a tiny one. The shadow used to be much more significant in version 1.3.4.

p-fischer avatar Jul 28 '17 11:07 p-fischer

Elevation is always on for BottomBar. I do workaround by wrapping BottomBar with LinearLayout with elevation (background need to be set) and setting app:bb_showShadow="false".

mkaflowski avatar Nov 08 '17 15:11 mkaflowski