What does android:layout_weight mean?

前端 未结 13 1542
遇见更好的自我
遇见更好的自我 2020-11-21 06:14

I don\'t understand how to use this attribute. Can anyone tell me more about it?

13条回答
  •  萌比男神i
    2020-11-21 06:43

    With layout_weight you can specify a size ratio between multiple views. E.g. you have a MapView and a table which should show some additional information to the map. The map should use 3/4 of the screen and table should use 1/4 of the screen. Then you will set the layout_weight of the map to 3 and the layout_weight of the table to 1.

    To get it work you also have to set the height or width (depending on your orientation) to 0px.

提交回复
热议问题