Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove ColorFilter / undo setColorFilter

Tags:

android

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

like image 948
Team Pannous Avatar asked Aug 19 '11 21:08

Team Pannous


3 Answers

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.

like image 184
Carl Avatar answered Oct 21 '22 13:10

Carl


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)

like image 43
nicholas.hauschild Avatar answered Oct 21 '22 13:10

nicholas.hauschild


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.

like image 3
SANAT Avatar answered Oct 21 '22 14:10

SANAT