Build betuer Android apps, with vector assets
@LukeSleeman (Itty Bitty Apps) @MarcEdwards (Bjango)
Build be tu er Android apps, with vector assets @LukeSleeman @ - - PowerPoint PPT Presentation
Build be tu er Android apps, with vector assets @LukeSleeman @ MarcEdwards (Itty Bitty Apps) (Bjango) Outline What are vector assets? Creating and exporting SVGs Converting SVGs to VectorDrawables Using VectorDrawables in your
@LukeSleeman (Itty Bitty Apps) @MarcEdwards (Bjango)
What are vector assets? Creating and exporting SVGs Converting SVGs to VectorDrawables Using VectorDrawables in your apps The Marc and Luke 4 step plan Questions?
Vector Bitmap
Smaller files and faster loading. One file for all pixel densities. Dynamic colours, and other dynamic drawing. Did we mention smaller files? Smaller files!*
Vector assets can have performance issues. Can use a lot of memory while rendering. Can only be used for certain things. Choose wisely!
Scalable Vector Graphics files. XML files, containing shapes, paths and styling data. Initially released in 2001, but increasingly popular. SVG 2.0 is in flux right now. Pronounced with a hard G.
Android specific vector format. Subset of SVG: Supports group, path, clipPath, and transforms. Quicker and easier to render than SVG.
This image is pretty ugly and blurry. If its quick and easy to do re-draw it,Yes! Maybe? 🤕 No way.
223.1 MB
Illustrator Photoshop Sketch Affinity Designer
Create using a 1dp grid. “Flatten” or combine boolean operations. If you use text, outline it. Remove redundant points.
As automated as possible. Faster, and less mistakes. Less effort to make changes.
Create artwork on artboards. Export with Export for Screens. 100 artboard limit? 1000 artboards!
Create artwork on artboards or in groups. Export with Export As or Generator. Don’t use Photoshop? Or use Photoshop + PaintCode!
Create artwork on artboards or in groups. Export with Make Exportable. Slices are good!
Create artwork on artboards or in groups. Export with Export Persona. Slices are good!
We have ✨SVG’s✨ 🤕 Now how to get VectorDrawables?
Features that cause problems: clip paths Inner and outer strokes gradient fill (7.0, SDK 24+) fill rule - evenodd, etc (7.0 SDK 24+) transforms <defs>
It would be nice if we could somehow visually show what these things are. I think it may be a bit to much work to draw up examples of each of them though1. Android Studio import
SvgToVectorDrawableConverter.Web/
http://inloop.github.io/svg2android/
#3 - SvgToVectorDrawableConverter.Web
http://a-student.github.io/SvgToVectorDrawableConverter.Web/
Transform Fill rule Gradient Inner stroke Clip paths <Defs>
Recommendation:
SVG2Android a close second also Keep checking Android Studio for updates: https:// issuetracker.google.com/issues/37092389
1. Native vector drawable generation
for backwards compatibility
Add your vector drawable xml file to res/drawable/ Reference it like any other drawable API 21 (Android 5.0) has native support API 24 (Android 7) has better support - Fill types (even-odd), gradient fill Other misc bugs in android 5.0 and 6.0
100dp 100dp
Set minSdkVersion < 21, eg below android 5.0 No build changes required at all - just drop in Vector Drawable to project! Only supports limited set of elements Cant reference colours.xml from xml
APK contents:
APK contents:
APK contents:
Backwards compatibility library which extends Drawable to create VectorDrawableCompat Uses VectorDrawableCompat when running below API 24 (Android 7). API 24+ it uses native implementation Allows you to get vector drawable features only supported in API 24 Vectors are Sharp on all API levels! Can use colors.xml values
Perhaps native if your are targeting API 23 (Android 6.0) and up
Create using a 1dp grid. “Flatten” or combine boolean operations. If you use text, outline it. Remove redundant points.
Illustrator, using artboards and Export for Screens Sketch, using Make Exportable Affinity Designer, using Slices Photoshop, by importing into PaintCode
Use PaintCode If you cant use that - try SVG2Andoid Keep checking for those Android Studio updates …
Use support-vector-drawable If you are only supporting the latest versions of Android, perhaps native will work
@MarcEdwards (Bjango) @LukeSleeman (Itty Bitty Apps)