How to create vector drawables for android?

前端 未结 7 951
闹比i
闹比i 2021-01-29 19:11

I am new to VectorDrawables.

I can see that the default vector drawables provided with android studio like ic_menu_gallery,

7条回答
  •  情书的邮戳
    2021-01-29 19:47

    Here is the best method to convert any png/jpg into vector drawable:

    1. Download the software InkScape

    2. Open your png in it and follow the procedure shown in the video to convert it to svg

    3. The use the SVG to Vector Drawable tool to convert the svg to vector drawable. The other tool svg2android does not always work as sometimes the svg gets improperly converted to a vector drawable

    4. Copy the code into a new drawable resource file. Now this can be used as a regular drawable.

    If you already have a svg then start straightaway from step 3.

提交回复
热议问题