<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/star_icon"
android:id="+@starid"/>
I need to change tint color of icon programmatically help me
Thanks for Hardik, orginal answer
You can change the tint, quite easily in code via:
imageView.setColorFilter(Color.argb(255, 255, 255, 255));
If you want color tint then:
imageView.setColorFilter(ContextCompat.getColor(context,
R.color.COLOR_YOUR_COLOR));
with mode:
imageView.setColorFilter(ContextCompat.getColor(context,
R.color.COLOR_YOUR_COLOR), android.graphics.PorterDuff.Mode.MULTIPLY);
in my case:
imgBottomDivider.setColorFilter(ContextCompat.getColor(getContext(),
mPreferences.isNightMode() ? R.color.colorWhite : R.color.colorBlack));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With