i have two buttons next to each other. I want them to be the same size and fill the whole width of the screen. I've been trying with this code: (It's relativelayout, if that matters)
<Button android:text="Names"
android:id="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</Button>
<Button android:text="Dates"
android:id="@+id/Button02"
android:layout_toRightOf="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</Button>
Wrap a LinearLayout around the buttons? then you can use padding to adjust the exact location if needed
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:text="Names"
android:id="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</Button>
<Button android:text="Dates"
android:id="@+id/Button02"
android:layout_toRightOf="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</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