I want to programmatically remove (reset) my ImageView Tint color which was already set in XML layout.
1 Answer
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
9 Comments
Gibolt
imageView.clearColorFilter()Gabby
imageView.setBackgroundTintList(null)RRGT19
ImageViewCompat.setImageTintList(imageView, null); works for me.konnovdev
@RRGT19 thanks! using ImageViewCompat is the only way that works for me
|
imageview.setColorFilter(null);