smilevchy
9/27/2015 - 2:40 PM

Something about when to use View.AT_MOST, View.UNSPECIFIED or View.EXACTLY ......

Something about when to use View.AT_MOST, View.UNSPECIFIED or View.EXACTLY ......

MeasureSpec.EXACTLY - A view should be exactly this many pixels regardless of how big it actually wants to be.

MeasureSpec.AT_MOST - A view can be this size or smaller if it measures out to be smaller.

MeasureSpec.UNSPECIFIED - A view can be whatever size it needs to be in order to show the content it needs to show.

When match_parent or an constant dimension value is set to layout_width or layout_height, MeasureSpec.EXACTLY will be applied when measuring the view

MeasureSpec.AT_MOST will be applied to views that have been set to WRAP_CONTENT if the parent view is bound in size

In special cases, the bounds do not matter. Eg. ScrollView.In the case of these special cases, the height of the child Views are irrelevant. As such, it will supply an UNSPECIFIED to the children Views which tells the children that they can be as tall as they need to be