Custom Views and ViewGroups
Overriding onMeasure (Part 3)
Autoplay
Up next
Previous
About
An example of how to write a custom implementation of a custom view’s onMeasure()
method.
Builds on the previous lesson’s four example layouts with the TimerView
from the first lesson to improve and correct the layout behavior. Iterates through the onMeasure()
implementation to show different approaches and the different factors coming into play when trying to build flexible and adaptable measurement logic.
In this episode you will learn:
- How to override the
onMeasure()
method with custom logic. - What factors might affect the measurement of views.
- How to estimate text size as part of the measurement of views.
- How to reconcile measured view content with layout parameters and parent constraints.
- How to incorporate padding into measurement calculations.
References
Instructor
Links
Comments
Lessons in Custom Views and ViewGroups
Custom Views and ViewGroups (Part 1)
10:56
Custom Views and ViewGroups (Part 2) – How Views Are Measured

Pro
07:31
Overriding onMeasure (Part 3)

Pro
10:03
Custom Views and ViewGroups (Part 4) - Custom Views Versus Custom ViewGroups

06:32
Custom Views and ViewGroups (Part 5) - How onLayout Works

Pro
04:46
Setting Up a ViewGroup Subclass (Part 1)

04:49
Custom ViewGroups (Part 2): Supporting Margins with MarginLayoutParams

Pro
03:44
Custom ViewGroups (Part 3): onMeasure Helpers

Pro
04:54
Custom ViewGroups (Part 4): Implementing onMeasure

Pro
05:27
Custom ViewGroups (Part 5): Implementing onLayout

06:23

Something went wrong
Lesson added to playlist
Create new playlist
Name can't be empty