Open adfleshner opened 9 years ago
Have you tried to set the color filter on the drawable and then set this drawable on the fab programmatically?
Not working either - has anyone updates on this?
Any updates on this?
Normally there would be two ways of doing it:
FloatingActionButton fab= findViewById(R.id.fab);
fab.setColorFilter(color, PorterDuff.Mode.SRC_IN);
That doesn't work. You must use this instead:
FloatingActionButton fab = findViewById(R.id.fab);
Drawable icon = getDrawable(R.drawable.ic_icon);
icon.setColorFilter(color, PorterDuff.Mode.SRC_IN);
fab.setImageDrawable(icon);
It worked for me at least.
I was curious if there was a way to set the color filter on a drawable on the fab.
I see a protected function getIconDrawable but like i said it is protected so im not able to use it. and get drawable returns null. I was just curious if there was any way to get it so I can update the filter.