PercentLayoutHelper

This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack.
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.

public
class
PercentLayoutHelper
extends Object

java.lang.Object

↳

android.support.percent.PercentLayoutHelper

This class was deprecated
in API level 26.1.0.
consider using ConstraintLayout and associated layouts instead. The following shows
how to replicate the functionality of percentage layouts with a ConstraintLayout. The Guidelines
are used to define each percentage break point, and then a Button view is stretched to fill
the gap:

This class collects utility methods that are involved in extracting percentage based dimension
attributes and applying them to ViewGroup's children. If you would like to implement a layout
that supports percentage based dimensions, you need to take several steps:

handleMeasuredStateTooSmall

Iterates over children and checks if any of them would like to get more space than it
received through the percentage dimension.
If you are building a layout that supports percentage dimensions you are encouraged to take
advantage of this method. The developer should be able to specify that a child should be
remeasured by adding normal dimension attribute with wrap_content value. For example
he might specify child's attributes as app:layout_widthPercent="60%p" and
android:layout_width="wrap_content". In this case if the child receives too little
space, it will be remeasured with width set to WRAP_CONTENT.

Returns

boolean

True if the measure phase needs to be rerun because one of the children would like
to receive more space.