Measure, Layout, Draw, Repeat: Custom Views and ViewGroups
summary
Shows what actually gets implemented: a working tally counter as a flat custom View and a custom composite ViewGroup list item, drawn on a Canvas with Paint, centered text, and a line under it, and measured with font metrics and resolveSize logic. Covers the three phases measure layout draw, the practical APIs used like onDraw, onMeasure, invalidate and measureChildWithMargins, the four constructors and why allocating in onDraw kills performance, and what still needs work like attributes and accessibility.
AI-written summary · about
chapters (27)
- 0:00Start
- 0:37Why Would You Ever Want To Write Your Own Custom View
- 1:50Performance
- 5:13How Does Android Draw
- 8:07Creating Custom Views
- 8:19Extending an Existing View Class
- 8:40Flat Custom View
- 9:24Composite View Groups
- 9:46Composite View Group
- 10:05Custom Composite View Group
- 11:26Custom Views
- 12:55Override the Constructors in the Base View Class
- 15:25Translating from Dps and Sps to Pixels
- 19:00Invalidate Method
- 23:26Layout Parameters
- 25:32Set Measure Dimension Is Mandatory
- 25:53Setting a Final Size and Position
- 26:56Font Metrics
- 30:46Custom View Groups
- 33:18Xml Layout
- 34:05Layout Parameters
- 36:47Generate Layout Forums
- 38:30Measure Child with Margin
- 39:58Measure Child with Margins
- 44:19Set Custom Attributes on Your Views
- 44:42Accessibility
- 46:45Hardware Acceleration
related talks
42mMeasure. Layout. Draw. Repeat: Custom Views and ViewGroups
40mWriting Custom Views for Android
40mPlease, Draw Me a View
26mThe Importance of Measure
49mCustom Drawing with Canvas
27mCustom Views - The Definitive Guide
35mMake It Fit, how Android measures and draws views
32mA Skeptics Guide to Programmatic Views on Android
