How I can create single vector xml drawable like this (black shape):
To be able to use this in imageView and change it color
How I can create single vector xml drawable like this (black shape):
To be able to use this in imageView and change it color
To create the required shape as a vector drawable, use the following code.
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="12"
android:viewportWidth="12">
<path
android:fillColor="Set_Your_Color"
android:pathData="M 2,9 C 2,9 4,10 6,10 C 8,10 10,9 10,9 L 10,0 2,0 2,8"
android:strokeWidth="0.1"/>
</vector>
Edit the values in the vector to fit it exactly to your requirements.
To use the vector drawable in ImageView, you can either do it programmatically using:
image.setImageResource(R.drawable.myDrawable);
or by XML:
app:srcCompat="@drawable/mydrawable