Crafting Custom Android Views
summary
Creates a reusable UnderlineTextView that extends TextView, adds a Paint and underline height, uses setPadding to avoid changing onMeasure, draws a bottom rect in onDraw, loads attrs from attrs.xml via TypedArray and recycles it, and demos in Android Studio with Gradle — the demo runs. Covers saving view state with BaseSavedState Parcelable pattern, touch handling with VelocityTracker and flinging via OverScroller plus postOnAnimation, and platform-consistent feedback like EdgeEffect and scaled ViewConfiguration constants.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 2:55Understanding Android views
- 8:18Why create custom views
- 12:43Demo: custom underline view
- 23:04Advanced rendering passes
- 28:31State saving and restoration
- 31:49Touch event handling
- 35:58Animations and velocity
- 41:25Consistency and edge effects
- 45:16Conclusion and Q&A








