3
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"
    android:elevation="5dp"
    app:cardCornerRadius="5dp">


<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

<ImageView
    android:id="@+id/img_delete"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_margin="7dp"
    android:src="@drawable/ic_remove"
    app:tint="@color/design_default_color_error"
    android:tint="@color/white"
    /> <!-- Setting tints of Image -->


</LinearLayout>
</androidx.cardview.widget.CardView>

This code shows to add tint in ImageView, i want to ask what is tint where is its effect and and what is the difference between two type of tints i have used.

ADM
  • 20,406
  • 11
  • 52
  • 83

1 Answers1

4

In both case that will set the tinting color of the image but android:tint has some issues with compatibility reasons see here. Also it was not working for version below api level 21. So using app:tint would be the best way.