Unable to load Drawable vector in bitmap in XML

This is my first Vector-Drawable's code to load layer-list. It works great. I had to change the color of my vector. I believe that I should add a bitmap to use the attribute tint. This is my first code and a vector suitable for drawing is perfectly displayed 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 cannot load a vector-Drawable into a 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>

the problem is here. I cannot load a vector image in a bitmap, this leads to the failure of my application.

+4
source share

Source: https://habr.com/ru/post/1664832/


All Articles