Android Application Development (AND-401) — Question 101

Which of the following are layout-related methods called by the framework on views, and you can override them when customizing a view? (Choose two)

Answer options

Correct answer: A, D

Explanation

The correct answers are onMeasure() and onSizeChanged() because these methods pertain to the layout process of a view, allowing developers to customize how a view measures and responds to size changes. onDraw() is used for rendering the view's content, and onKeyUp() is related to key event handling, making them unsuitable for layout customization.