I use the following function to enable and disable drawings ...
public static void setDrawableState(Drawable d, boolean enabled)
{
if (d == null)
return;
d.mutate();
if (enabled)
d.setAlpha(255);
else
d.setAlpha(100);
}
This worked on all the phones that I have tried, now I see that it does not work on Android 4.4.2 (maybe not even on a specific version).
Is there any other (better) way to set the alpha method for drawing? Or am I missing something?
source
share