Cannot load vector Drawable in bitmap in XML

1.2k views Asked by At

This is my first code that loads a Vector-Drawable in layer-list. it works fine.Later I had to change color of my vector drawable. I find that I should add bitmap to use tint attribute. This is my first code and vector drawable show fine in layer-list.

<item>
    <shape
        android:padding="1dp"
        android:shape="oval">
        <corners
            android:bottomLeftRadius="5dp"
            android:bottomRightRadius="5dp"
            android:topLeftRadius="5dp"
            android:topRightRadius="5dp"/>
        <solid android:color="@color/accent"/>
    </shape>
</item>
<item android:drawable="@drawable/ic_check_black_24px"/> // this is vector drawable

so I changed my code to this. I can not load vector-Drawable in bitmap in XML.

<item>
    <shape
        android:padding="1dp"
        android:shape="oval">
        <corners
            android:bottomLeftRadius="5dp"
            android:bottomRightRadius="5dp"
            android:topLeftRadius="5dp"
            android:topRightRadius="5dp"/>
        <solid android:color="@color/accent"/>
    </shape>
</item>
<item>
    <bitmap
        android:src="@drawable/ic_check_black_24px"
        android:tint="@color/white"/>
</item>

problem is here. I cannot load vector-drawable in bitmap,it causes to crash my app.

0

There are 0 answers