0

I have noticed when playing with weighted layouts (one widget takes 30% of screen and the other 70%) that in order to get 30% of the screen taken I need to use a weight of .7 on the widget (this case a button) and to get 70% of space taken I need to use a weight of .3 (this case a relative layout).

Can someone tell me the logic for making a larger weight take up less space.

Thanks in advance

4

1 回答 1

2

如果您将视图宽度设置为android:layout_width="match_parent"它的行为就像您在问题中提到的那样,这与人们所期望的相反。如果您将宽度设置为,android:layout_height="wrap_content"否则android:layout_height="0dp"它将按您的预期工作。

于 2013-02-21T18:14:01.617 回答