I set tint color with tint mode multiply in Imageview
xml and I want to change only tint color in from java in button click. I tried this
imageView.getBackground().setColorFilter(ContextCompat.getColor(MainActivity.this,R.color.blueish), PorterDuff.Mode.MULTIPLY);
but it gave exception and I also tried this
imageView.setColorFilter(ContextCompat.getColor(MainActivity.this, R.color.blueish), android.graphics.PorterDuff.Mode.MULTIPLY);
but nothing happens
This is my xml code
<ImageView
android:id="@+id/imageview"
android:layout_width="match_parent"
android:tintMode="multiply"
android:tint="#ffae"
android:layout_height="580dp"
android:src="@drawable/as"/>
You can use the following to set tint of your ImageView: