java.lang.Object | |
↳ | com.facebook.drawee.view.AspectRatioMeasure |
A utility class that performs measuring based on the desired aspect ratio.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | AspectRatioMeasure.Spec | Holder for width and height measure specs. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AspectRatioMeasure() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static void |
updateMeasureSpec(AspectRatioMeasure.Spec spec, float aspectRatio, ViewGroup.LayoutParams layoutParams, int widthPadding, int heightPadding)
Updates the given measure spec with respect to the aspect ratio.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Updates the given measure spec with respect to the aspect ratio.
Note: Measure spec is not changed if the aspect ratio is not greater than zero or if layoutParams is null.
Measure spec of the layout dimension (width or height) specified as "0dp" is updated to match the measure spec of the other dimension adjusted by the aspect ratio. Exactly one layout dimension should be specified as "0dp".
Padding is taken into account so that the aspect ratio refers to the content without
padding: aspectRatio == (viewWidth - widthPadding) / (viewHeight - heightPadding)
Updated measure spec respects the parent's constraints. I.e. measure spec is not changed if
the parent has specified mode EXACTLY
, and it doesn't exceed measure size if parent has
specified mode AT_MOST
.
spec | in/out measure spec to be updated |
---|---|
aspectRatio | desired aspect ratio |
layoutParams | view's layout params |
widthPadding | view's left + right padding |
heightPadding | view's top + bottom padding |