How does android:layout_weight work?

前端 未结 8 2094
后悔当初
后悔当初 2020-12-02 20:35

When I have the following, it shows top layout with four colors has much smaller area than the bottom layout area.

According to this documentation, when you add more

8条回答
  •  盖世英雄少女心
    2020-12-02 21:01

    If you are using fill_parent in a LinearLayout the layout will take as much space as possible and all layout items defined later will have to deal with the space left.

    If you set the height of both of you LinearLayouts to wrap_content the weight should work as documented.

提交回复
热议问题