SVG is a vector diagram, just touch can not be carefully introduced, but just remember one thing: amplification is not distorted, storage is also convenient.
Since most floor plans use the SVG format, the original SVG format file must be converted to an XML suffix vectordrawable file using the relevant conversion tool.
Through the almighty Baidu query, found already someone has done the relevant conversion tools.
Address 1--svg2android: This is an open source project on Git, clone down and then open index in the browser to use.
PS: Firefox does not seem to support Bake transforms into path (experimental), need Google browser (can be checked) or other browser (not tried).
Address 2--svg-android: It's also an open source project on Git, which converts SVG directly to a picture like PNG.
PS: Only clone down the project, see the relevant code, and no specific test, because currently do not need to convert SVG to a picture to use.
Native normal SVG files can be converted from the above tools to Android using the Vectordrawable file, but I need to cut the SVG part of it? After cutting, adding, and modifying, do I need to zoom in or out of SVG?
Then you need to inkscape this powerful vector graph editor.
After you've done whatever you want, did you click OK at the time you saved it, but you forgot to format it correctly?
That's how I do it, just click OK, then go to Androidstudio (in fact as the SVG to vectordrawable function), found not to read normally, as the hint that this is an empty file (or can not find the corresponding label).
File >>> New >>> Vector Asset >>> Local SVG file >>> Image file ...
Do not fret, the first reading error must be the file format is not supported, the original SVG file in the as is sure to get a good conversion effect, but you through the third-party vector Map Modification tool, after editing and then save, usually carry some information with third-party tools.
Then you need to look at it and choose the appropriate suffix when you save it.
When I use it, I find that the default Inkscape svg and normal svg are saved, the former will be more than a lot of third-party defined information, what kind of layer.
And ordinary SVG relatively, is only a few third-party information, the modified structure is still based on line such a label-based, for the conversion, not very friendly.
Then I use the optimized SVG to save, it will pop out some options, through the collection of these options, the open after saving the SVG source code with the native SVG file almost no difference.
The only more out of the transform= "Matrix (a,b,c,d,e,f)" Such a property, through Baidu learned that this is the University of the high number of matrix transformation, the conversion is a little complicated.
So as even if the "optimized SVG" file can be converted, the effect of the preview is also biased, in particular, the element offset caused by this property.
So looking back at the Svg2android tool above, why do you want to mention the Bake transforms into path (experimental) attribute?
It is because of its support for transform that the converted image is not offset to a certain extent.
So the conclusion comes:
1, normal native SVG file, using as self-with converter can (special convenience).
2. If the as self-band converter is not available (it is possible that a third-party editor caused an error in the coordinate conversion), then use Svg2android to convert the format.
3, if the coordinates can not be converted, then use sax, parsing the SVG file tags, one by one, corresponding to the label in the Vectordrawable.
The third part of the conclusion is still in the writing code, in fact, this is only a special SVG file response, I believe that the previous two tools have been the general meaning of SVG has been very good conversion support.
"Android" SVG and vectordrawable--related format conversion