android path 合并,如何创建android:pathData?

so i'm going to need to use path data in my app,

is there a way to convert images you already have to path data ?

or the only way is to actually calculate all the pixels yourself using Photoshop etc.. ?

解决方案

Assuming you're referring to the pathData element of a VectorDrawable, if you have the images in .svg format you can convert them easily.

Either do it directly in Android Studio by right-clicking on the drawable folder then New>Vector Asset and import your local SVG file:

37f02fc0b1d11c873bad9931450ce360.png

Or use another converter like svg2android(you might find this works on files that Android Studio fails to convert).

If you don't want a VectorDrawable and just want to get the pathData you can open an SVG in a text editor. If the images you have aren't in a vector format already things will be more difficult.