setLayoutWeight

fun View.setLayoutWeight(layoutWeight: Float?)

Sets the LinearLayout.LayoutParams.weight for the View inside a LinearLayout to the given layoutWeight. If layoutWeight is null, the layout weight is set to 0.

Throws

when the view has a different type of layout as parent.