Dallas Android Developers Feb
Dallas Android Developers Feb
MCS: Texas A&M simulation and graphics Software engineer here at Valtech
Overview
Android View and Graphics Architecture Quick review of Creating Custom Components
View Basics
Invalidate
Draw
When onDraw is called -Walks down view tree drawing invalid views -Draws front to back
Surface to Screen
June Meet-up Recording: Custom UI Controls by Luke Wallace on the Dallas Android Developers meet-up site under pages/recording of past meetings
http://www.meetup.com/Dallas-Android-DevelopmentGroup/pages/Recordings_Of_Past_Meetings/
Extend a View object an Override OnMeasure OnDraw Invalidate when you need to update
Resources of different densities Nine patches Vector Graphics Canvas and Paint
Huge-cube by MI-wikier
Standard Approach
Different Resources for different screen sizes and densities -specify dps or wrap content layout not pixels -Don't want resource scaled? Use nodpi
Nine Patches
-Grow an image by reproducing sections of it -draw9patch available in android sdk
Image from android developers draw 9 patch documentation
Are SVG usable on Android? Why not do everything using SVG files?
Library called SVG-Android Open source Library is 16.4 kb It isn't usable in icons
http://www.pushing-pixels.org/2011/11/04/about-thosevector-icons.html
From MindTheRobot www.mindtherobot.com Look under Thermometer and AnalogDial includes source
Android Design preview tool http://code.google.com/p/android-ui-utils/ ADB shell am display-size 1023X768 -bluetooth keyboard
GIMP Inkscape
http://www.guru.c om/
This Image Modified from Google IO 2011 Accelerated Android Rendering Roman Guy and Chet Hasse
Use
four-parameter variant of invalidate() rather than the version that takes no parameters
from For Butter or Worse Google IO 2012 Chet Hasse Roman Guy
Image
Hardware Acceleration
-Must have GPU -Doesn't support everything -easy to turn on
Tools
lint Developer Options Show Overdraw
Profile GPU rendering
HierarchyViewer
http://www.curious-creature.org/2012/12/01/android-performancecase-study/
Surface/Texture Views
-More responsive, don't wait for view update -heavy weight -manage calling onDraw yourself -lock the surface do work unlock