Elevation + transparency bug on Android Lollipop
Asked Answered
R

1

6

Using a background color for a view with some alpha (e.g. #99fe0038) and some elevation on API 21 reveals two circles: one for the view itself and another inside:

Elevation and background color are set via code:

view.setElevation(getResources().getDimensionPixelSize(R.dimen.fab_elevation_lollipop));
view.setBackgroundColor(Color.parseColor("#99fe0038"));

Without setting elevation or with using an opaque color everything looks like expected.

Is it an Android bug or have I missed something here?

Ratable answered 16/11, 2014 at 19:12 Comment(1)
Still happening on API 24 and 26 (real device and emulator)... this is the only link I found related to this issue, no body seems to have a solution... Got here actually from your GitHub: github.com/makovkastar/FloatingActionButton/issues/41Igorot
C
0

Removing shadow effect worked for me.

FAB.setShadow(false);        
FAB.setBackgroundColor(getResources().getColor(R.color.fab_transparent));
Carrick answered 1/7, 2016 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.