Skip to content Skip to sidebar Skip to footer

App:srccompat Does Not Work For Imageview

I'm adding vector drawable support to a library project, and using app:srcCompat to reference the vector drawable. The only view that appears to work is ImageButton and I'm not sur

Solution 1:

Maybe you could try changing ImageView to AppCompatImageView. So it becomes:

<android.support.v7.widget.AppCompatImageView
   android:id="@+id/iconActive"
   style="@style/Widget.MyCompany.Button.Icon"
   app:srcCompat="@drawable/activities"
   android:layout_marginTop="16dp"
   android:tint="@color/white"
/>

Solution 2:

try this

    xmlns:app="http://schemas.android.com/apk/res-auto"


<androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/img_cross"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dp"
            app:srcCompat="@drawable/cross" />

Solution 3:

Work for me

xmlns:app="http://schemas.android.com/apk/res-auto"


    <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/img_cross"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:layout_marginRight="10dp"
                app:srcCompat="@drawable/cross" />

Post a Comment for "App:srccompat Does Not Work For Imageview"