Use SVG image format

Source: Internet
Author: User

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.

IndrawableFolder, you will find.xmlFormat.

Import images in the code.

    
  

Display

If yesNon-AS2.0Version, 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 ordrawableFolder, create.xmlFile, 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.