Before I decided to ask it, I search some Remove Tint Color Programmatically, but it marked as duplicate so I didn't know if this is also a duplicate or not? because it didn't answer my question, I think.
Because I am asking also if is it possible to RESET or REMOVE the tint of ImageView after changing the drawable.
This is the normal image
This is the selected image
and this is the normal image again after deselecting the image
and this is my code.
if (isSelected) {
// Reset the ImageView to normal
isSelected = false
imgHeart.setImageDrawable(itemView.context.getDrawable(R.drawable.baseline_favorite_border_24))
} else {
// Tint ImageView to Red
isSelected = true
imgHeart.setImageDrawable(itemView.context.getDrawable(R.drawable.baseline_favorite_24))
imgHeart.imageTintList = ColorStateList.valueOf(ContextCompat.getColor(itemView.context, R.color.colorRedHeart))
}
I also try the imgHeart.imageTintList = null but the image is turning into white or disappear.
I also try the imgHeart.colorFilter = null but the image is do nothing and turning into the last image.
I am using the Material Design Icon.
What I want to bring back the image into normal drawable as you see in the first image.
Thank you.


