In android, how should I put 2 buttons in one row having same width and height? Which layout should I use?
layout_weight is responsible for setting up components in equal or different proportions.
Use This :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
>
<Button android:text="@+id/Button01" android:id="@+id/Button01"
android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="@+id/Button02" android:id="@+id/Button02"
android:layout_weight="1" android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With