SetAlpha does not work on ViewGroup instance

setAlphadoesn't affect instances ViewGroupin APIs 14 (ICS) -19 (KitKat), even if it was introduced in API level 11. Any ideas why?

I even tried to use the support library, but this does not work either.

Example:

LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
ViewGroup view = (ViewGroup) layoutInflater.inflate(R.layout.my_layout, null);
view.setAlpha(0.5f);

It works great for API levels 21+, but not for API levels 14-19.

PS, I have not tested below API level 14.

+4
source share

Source: https://habr.com/ru/post/1654162/


All Articles