开发者

Android how to get components inside a layout to take up an equal percentage of space

开发者 https://www.devze.com 2023-04-06 13:09 出处:网络
For examples two buttons inside a linear layout or a relative layout.Have each b开发者_如何学JAVAutton always take up 50% of space in parent container. How is this specified? Thanks<LinearLayout>

For examples two buttons inside a linear layout or a relative layout. Have each b开发者_如何学JAVAutton always take up 50% of space in parent container. How is this specified? Thanks


<LinearLayout>
<Button
    layout_weight="0.5"
/>
<Button
    layout_weight="0.5"
/>
</LinearLayout>

each button will take 50% of the linearLayout.

0

精彩评论

暂无评论...
验证码 换一张
取 消