diff --git a/xcore/src/main/java/com/controlj/layout/FrameGroup.kt b/xcore/src/main/java/com/controlj/layout/FrameGroup.kt index 49d94ab..efa22f7 100644 --- a/xcore/src/main/java/com/controlj/layout/FrameGroup.kt +++ b/xcore/src/main/java/com/controlj/layout/FrameGroup.kt @@ -28,7 +28,7 @@ import com.controlj.shim.CxFactory * determine where in the FrameGroup the child appears. The position of each child is independent of * all other children */ -open class FrameGroup(layout: Layout = Layout()) : ViewGroup(layout) { +open class FrameGroup(layout: Layout = Layout(), name: String = "") : ViewGroup(layout, name) { /** * The measured size of a frame group is the smallest box that will enclose all its subviews. diff --git a/xcore/src/main/java/com/controlj/layout/Layout.kt b/xcore/src/main/java/com/controlj/layout/Layout.kt index 5e42dba..de35ae2 100644 --- a/xcore/src/main/java/com/controlj/layout/Layout.kt +++ b/xcore/src/main/java/com/controlj/layout/Layout.kt @@ -88,6 +88,11 @@ class Layout( return Layout(widthMode = Mode.MatchParent, heightMode = Mode.MatchParent) } + fun matchWidth(): Layout = Layout(widthMode = Mode.MatchParent) + fun matchHeight(): Layout = Layout(heightMode = Mode.MatchParent) + fun weightedWidth(weight: Double = 1.0): Layout = Layout(widthMode = Mode.Weighted, weight = weight) + fun weightedHeight(weight: Double = 1.0): Layout = Layout(heightMode = Mode.Weighted, weight = weight) + fun absolute(width: Double, height: Double): Layout { return Layout(width, Mode.Absolute, height, Mode.Absolute) }