remove ColorFilter / undo setColorFilter

Android

Android Problem Overview


How can a ColorFilter be removed or setColorFilter on a view be undone?

Android Solutions


Solution 1 - Android

You can call clearColorFilter() for the same object on which you called setColorFilter(). This method is equivalent to setColorFilter(null), and is arguably more readable than the latter.

Solution 2 - Android

Have you tried setting it to null?

According to Android Documentation:

> public void setColorFilter (ColorFilter cf) > > Since: API Level 1 Apply an arbitrary colorfilter to the image. > Parameters > > cf the colorfilter to apply (may be null)

Solution 3 - Android

Try this :

Drawable play = ContextCompat.getDrawable(MainActivity.this, R.drawable.ic_action_play_arrow);
play.clearColorFilter();
view.invalidate(); // This is helpful when you apply morethan one color filter

Other two answers are also there which are helpful too. But, its working for me when i invalidate view.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTeam PannousView Question on Stackoverflow
Solution 1 - AndroidCarlView Answer on Stackoverflow
Solution 2 - Androidnicholas.hauschildView Answer on Stackoverflow
Solution 3 - AndroidSANATView Answer on Stackoverflow