android - Horizontal LinearLayout with Multiple Children, Move Children Below on New Line When No More Horizontal Space -
i have horizontal linearlayout
wide screen , high children, trick children have dynamic width each , don't want them going off screen (cut out). want them flow/break in new line visible.
although totally irrelevant android, should work similar how inline <div>
's work in html.
here's have right now:
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="if enter digits in field " /> <edittext android:id="@+id/tvdistance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="enter digits here"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" great" /> </linearlayout>
but children of linearlayout
wider screen part gets off screen/invisible.
i have horizontal linearlayout wide screen , high children, trick children have dynamic width each , don't want them going off screen (cut out).
a linearlayout
can't that(any default layout sdk can't that) because linearlayout
set place all children in one horizontal or vertical line. also, type of conditional layout rules based on dimensions not yet available(like in case available width linearlayout
) not possible in xml anyway.
what need custom layout measures children use available space moving non fitting children on new line below(a called flowlayout
).
edit:
google provides flexbox
library implements web's flexbox layout on android. using library, children of flexboxlayout
placed on multiple lines based on widths using flexdirection
(with value of row) , flexwrap
(with value of wrap) attributes.
Comments
Post a Comment