Writing Custom Views for Android
summary
Covers concrete practices for custom Android views: use onAttachedToWindow and onDetachedFromWindow to allocate and release resources, prefer the animation framework over manual timers for pulsing effects, and avoid deep view hierarchies because requestLayout bubbles up and is expensive. Explains measure/layout with MeasureSpec modes (EXACTLY, AT_MOST, UNSPECIFIED), how to implement custom LayoutParams, when to override onDraw versus dispatchDraw, touch negotiation via onInterceptTouchEvent and getScaledTouchSlop, and how to save view state correctly.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 0:42Why write custom views
- 3:48Life overview
- 22:50Drawing
- 26:59Instance State
- 29:21Touch Events
- 36:33Animations
related talks
27mCustom Views - The Definitive Guide
42mMeasure. Layout. Draw. Repeat: Custom Views and ViewGroups
40mPlease, Draw Me a View
51mMeasure, Layout, Draw, Repeat: Custom Views and ViewGroups
51mCrafting Custom Android Views
32mA Skeptics Guide to Programmatic Views on Android
27mView into the abyss
48mEfficient Android Layouts
