Android LinearLayout fill-the-middle

后端 未结 1 1620
借酒劲吻你
借酒劲吻你 2020-12-08 06:30

I have a vertical, set height (300px) LinearLayout (LL) with 3 nested LLs. 1 and 3rd are set with android:layout_height=\"wrap_content\" and the middle one with android:layo

相关标签:
1条回答
  • 2020-12-08 07:03

    Turned out (Thanks Mark Murphy for the answer) that all I was looking for was to set middle row to

    layout_height="0px" and layout_weight="1"

    If, after all the wrap_content and fixed-sized items are allocated for along an axis (horizontal or vertical), there is still room on that axis left over, LinearLayout then allocates the remaining space to those widgets with specified weights, in proportion to the weight.

    0 讨论(0)
提交回复
热议问题