Androider
Androider

Reputation: 21335

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

For examples two buttons inside a linear layout or a relative layout. Have each button always take up 50% of space in parent container. How is this specified? Thanks

Upvotes: 0

Views: 102

Answers (1)

Yashwanth Kumar
Yashwanth Kumar

Reputation: 29121

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

each button will take 50% of the linearLayout.

Upvotes: 2

Related Questions