1. svg know
SVG: android5.0 + appears, w3c launched
using xml language describing two-dimensional graphics, vector, zoom no effect
Why svg, and now the phone memory is short board, not the cpu, svg by cpu computing, png take up memory
on Android svg to be castrated, using Vector Drawable to support svg, svg small
2. svg syntax:
Vector profile syntax, how to read an SVG
(. 1) the Path command analysis as follows:
M = moveTo (the MX, the Y): move the pen to the specified coordinate position corresponding to inside android Path the moveTo ()
L = lineTo (LX, Y): draw a straight line to the specified coordinate position corresponding to inside android Path the lineTo ()
H = horizontal lineTo (the HX): draw a horizontal line to the specified X coordinate position
V = vertical lineto (VY): draw a vertical line to the specified coordinate position Y
C = curveto (C X1, Y1 , X2, Y2, ENDX, ENDY): cubic Bezier curve
S = smooth curveto (S X2, Y2, ENDX, ENDY) likewise cubic Bezier curves, and more smoothing
Q = quadratic Belzier curve (QX, Y, ENDX, ENDY): quadratic Bezier curve
T = smooth quadratic Belzier curveto (T ENDX, ENDY): mapping the same quadratic Bezier curves, smoother
A = elliptical Arc ( A RX, RY, XROTATION, FLAG1 , FLAG2, X, Y): an arc, corresponding to the arcTo ()
Z = closepath (): closed path (automatically draws a link start and end points)
Note, 'M' when dealing with, just move the brush, did not draw anything.
Svg with notepad ++ open a picture:
<path style="fill:#F2484B;" d="M115.528,421.736c25.394-30.139,39.715-68.501,39.715-109.236
c0-53.923-25.081-103.697-67.743-135.727v271.453c9.942-7.464,18.916-15.903,26.853-25.123
C114.693,422.592,115.091,422.138,115.528,421.736z"/>
According to the above grammar to identify:
Fill: filling
M: moved to the coordinate 115.528,421.736
C: cubic Bezier curve
svg online edit website:
https://editor.method.ac/
svg into Vector Drawable website, put under Drawable
http://svg.zhangningning.com.cn/
Android how to use SVG:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/method_draw_image"/>
Direct use as a normal picture can, for svg images
using AndroidStudio create svg:
drawable-> the Vector the Assert