Use SVG image format
SVG format, suitable for the screen, small images, there are many advantages, refer to. This article describes how to use SVG format.
SVG: Scalable Vector Graphics, which allows you to scale Vector images.
Siri: Internationalized Resource Identifiers, international Resource identifier.
Download an image in SVG format.
Create a project. A blank project shows an image.
Android Studio 2.0
Path: File-> New-> Vector Asset-> Local SVG file
SelectReset image sizeAndLeft and right layout adaptation.
Indrawable
Folder, you will find.xml
Format.
Import images in the code.
Display
If yesNon-AS2.0
Version, we can use online website conversion.
Web: http://inloop.github.io/svg2android/
Upload an SVG image to generate code.
SelectDelete empty GroupAndAdd Transform.
You can download online images ordrawable
Folder, create.xml
File, paste the code.
The usage method is similar to that automatically generated. You can directly add it.
We can see that all images are X images:
The automatically generated SVG image is 20 KB, and the online generated SVG image is 29KB.
While PNG (enlarged system image) requires kb, it is known that the SVG image is still very memory-saving.
For some large apps, using SVG images is very attractive.
Github
OK, Enjoy It.