How to set color for imageview in Android

If you are using an icon maybe this can be useful:

android:tint="@color/colorAccent"

Otherwise you can try to modify the class:

ImageView imageViewIcon = (ImageView) listItem.findViewById(R.id.imageViewIcon);
imageViewIcon.setColorFilter(getContext().getResources().getColor(R.color.blue));

More info in this thread: Is it possible to change material design icon color from xml in Android?


 DrawableCompat.setTint(imageView.getDrawable(), ContextCompat.getColor(getApplicationContext(), R.color.white));

Use

imageView.setColorFilter(getResources().getColor(R.color.color_white)); 

Use tint attribute of ImageView.

 android:tint="@color/colorAccent"

Tags:

Android