44

I want to programmatically remove (reset) my ImageView Tint color which was already set in XML layout.

John F. Miller
  • 26,961
  • 10
  • 71
  • 121
Md.Tarikul Islam
  • 1,241
  • 1
  • 14
  • 16
  • 5
    try `imageview.setColorFilter(null);` – V-rund Puro-hit Jul 20 '17 at 04:14
  • 21
    This question is NOT A DUPLICATE of the linked question and does not have an answer there (at the time of writing this comment). – talz Mar 25 '18 at 19:30
  • In older APIs you can use: https://developer.android.com/reference/android/support/v4/widget/ImageViewCompat#setimagetintlist passing null as the tintList – pandre Feb 07 '19 at 16:02

1 Answers1

58

I think if above things doesn't works, you can try adding the image again to the imageview programatically, while adding it again programatically don't set tintcolor for it, it will be inflated with the original color

    myImgView.setImageResource(R.drawable.yourDrwable);

or I think this should work for you.

    imageview.setColorFilter(null)

or

    imageView.clearColorFilter()

or

    imageView.drawable.setTintList(null)

or

    ImageViewCompat.setImageTintList(imageView, null);

updated based on the comments

Lino
  • 5,084
  • 3
  • 21
  • 39
Uday Ramjiyani
  • 1,407
  • 9
  • 22