Class LayoutSolver


  • public final class LayoutSolver
    extends java.lang.Object
    A constraint solver that divides a rect among children along one axis, always tiling the extent exactly: any rounding remainder goes to the last flexible item, or stretches the last item if none is flexible.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Rect[] solve​(Rect available, java.util.List<Constraint> constraints, Axis axis)
      Divides the available rect among the constraints along the given axis.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • solve

        public static Rect[] solve​(Rect available,
                                   java.util.List<Constraint> constraints,
                                   Axis axis)
        Divides the available rect among the constraints along the given axis.
        Parameters:
        available - the rect to subdivide
        constraints - the per-child sizing rules, in order
        axis - the axis to divide along
        Returns:
        one rect per constraint that together tile the available rect