Please, Draw Me a View
summary
Shows how to build a custom Android View by extending View, capturing size in onSizeChanged, and drawing with Canvas and Paint using drawRect, drawCircle, drawArc, and drawPath. Demonstrates using translate/rotate and save/restore to compose and animate, using Path and arcs for complex shapes, StaticLayout for multi-line text, ValueAnimator for property animation, gesture detection, and OutlineProvider for elevation. Gives a concrete, working example: a custom view with four animated arcs and small balls that swap positions.
AI-written summary · about
chapters (18)
- 0:00Welcome
- 1:10Custom views with Canvas
- 3:59Canvas and Paint basics
- 6:04Drawing rectangles and circles
- 8:33Canvas transformations
- 10:19View examples
- 14:17Drawing text with StaticLayout
- 17:48Complex shapes with Path
- 20:45Drawing arcs and circles
- 22:53Elevation and shadows
- 23:54Bézier curves and gestures
- 24:39Animating views with ValueAnimator
- 28:09Complete clock example
- 31:42Gesture handling
- 33:46View measurement
- 35:54PorterDuff and effects
- 37:40Material Design integration
- 39:05Conclusion
related talks
49mCustom Drawing with Canvas
40mWriting Custom Views for Android
51mMeasure, Layout, Draw, Repeat: Custom Views and ViewGroups
42mMeasure. Layout. Draw. Repeat: Custom Views and ViewGroups
51mCrafting Custom Android Views
32mA Skeptics Guide to Programmatic Views on Android
27mCustom Views - The Definitive Guide
35mMake It Fit, how Android measures and draws views
