How to add 2 buttons horizontally with a width of 50% for each in android?

How to add 2 buttons horizontally with a width of 50% for each?

+6
android
source share
2 answers
  • Put them in LinearLayout
  • Give them every android:layout_width="0px"
  • Give them every android:layout_weight="1"
+18
source share

Add both buttons to linearlayout and specify the orientation as horizontal. And specify the width as zero dp for both buttons, and layout_weight = 1 for each. He will work.

+1
source share

All Articles