Search code examples
androidsvgimageviewandroid-support-libraryandroid-vectordrawable

vector drawable not visible in api level 15 even after using the appCompat library version 23.3.0


I am using a vector drawable in an ImageView in API level 15. I am using the AppCompat library version "appcompat-v7:23.3.0" in my gradle, which brings in the support of SVG for lower API levels.

Here is my XML for ImageView:

<ImageView
        app:srcCompat="@drawable/check"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_below="@+id/ivProduct"
        android:layout_alignParentRight="true"
        android:paddingRight="@dimen/product_card_view_content_padding"
        android:id="@+id/ivAddedToCart"
        android:focusable="true"/>

This is the check.xml in drawable folder:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="#FF000000"
    android:pathData="M9,16.2l-4.2,-4.2l-1.4,1.4l5.6,5.6l12,-12l-1.4,-1.4z"/>

The ImageView is not being displayed at all. Can anyone please tell what is the mistake I am doing.


Solution

  • I got where the problem was. I was using this

    xmlns:app="http://schemas.android.com/tools"
    

    instead of this

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

    in the parent layout.