Set Tint Color Of ImageView (Support Library)

Apr 22, 2018
Change color of icon using Tint Color

Tint

ImageViewCompat.setImageTintList(imageView, ContextCompat.getColorStateList(context, R.color.colorAccent))

Tips: Change tint color of ImageView will effectively change the drawable color which is black color originally.

You can create a black color Material Vector Icon by File -> New -> Vector Asset -> Clip Art, then assign the drawable to ImageView by setImageResource(R.drawable.ic_add_black_24dp).

Color Filter

Make the image darker by applying black overlay with 70% opacity

imageView.setColorFilter(Color.argb((255 * 0.3).toInt(), 0, 0, 0))

Clear color filter

imageView.clearColorFilter()

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.