ImageView imageView = findViewById(R.id.my_image_view); imageView.setColorFilter(Color.RED);
ImageView imageView = findViewById(R.id.my_image_view); ColorMatrix matrix = new ColorMatrix(); matrix.setSaturation(0); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix); imageView.setColorFilter(filter);In this example, we create a ColorMatrix object and set its saturation to 0, effectively creating a grayscale color filter. We then create a ColorMatrixColorFilter object from that ColorMatrix and set it as the filter for the ImageView using the setColorFilter method. Overall, the setColorFilter method is a powerful tool for manipulating the appearance of images in an Android app, and is implemented in the android.widget.ImageView class in the android package library.