Make It Fit, how Android measures and draws views
summary
Shows how to implement reusable Android components: a font-aware TextView with attribute-based Typeface loading, caching via a HashMap, and a pie-chart View that animates by posting a Runnable and calling invalidate (or using the Choreographer). Covers exact code points: override onMeasure and call setMeasuredDimension, read attrs with obtainStyledAttributes and call TypedArray.recycle(), override onSizeChanged/onDraw, reuse Paints to avoid allocations, and detach to stop the animation. Demo compiles and renders in the IDE.
AI-written summary · about
chapters (4)
related talks
42mMeasure. Layout. Draw. Repeat: Custom Views and ViewGroups
51mMeasure, Layout, Draw, Repeat: Custom Views and ViewGroups
26mThe Importance of Measure
40mWriting Custom Views for Android
27mView into the abyss
40mPlease, Draw Me a View
32mA Skeptics Guide to Programmatic Views on Android
48mEfficient Android Layouts
