Sign in Go Pro

Custom Views and ViewGroups

Overriding onMeasure (Part 3)

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
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.

Sample Code

References

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Custom Views and ViewGroups