Language

TvInteractiveAppView.OnMeasure(Int32, Int32) Method

Definition

Measure the view and its content to determine the measured width and the measured height.

[Android.Runtime.Register("onMeasure", "(II)V", "GetOnMeasure_IIHandler", ApiSince=33)]
public virtual void OnMeasure(int widthMeasureSpec, int heightMeasureSpec);
[<Android.Runtime.Register("onMeasure", "(II)V", "GetOnMeasure_IIHandler", ApiSince=33)>]
override this.OnMeasure : int * int -> unit

Parameters

widthMeasureSpec
Int32

horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

heightMeasureSpec
Int32

vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

Attributes

Remarks

Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overridden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.

The preceding default-size description applies to the generic View implementation. In Android 16, this override measures its child SurfaceView with widthMeasureSpec and heightMeasureSpec, then resolves this view's dimensions from the child's measured size and state.

Based on the Android 16 view implementation.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Android reference for android.media.tv.interactive.TvInteractiveAppView.onMeasure.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to