In my app two button arranged vertically in LinearLayout. i want to provide a gap between two buttons. Please provide a solution...
my layout as follows
<?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="wrap_content"
android:orientation="vertical"
android:padding="10dp"
>
<Button
android:id="@+id/btnAction1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cool_button"
android:text = "HiText1"
/>
<Button
android:id="@+id/btnAction2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cool_button"
android:text="HiText2"
android:layout_below="@id/btnAction1"
/>
</LinearLayout>
image
thanks in advance
Add a margin (android:layout_marginTop="50dp") to the top of of the second button:
<?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="wrap_content"
android:orientation="vertical"
android:padding="10dp"
>
<Button
android:id="@+id/btnAction1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cool_button"
android:text = "HiText1"
/>
<Button android:layout_marginTop="50dp"
android:id="@+id/btnAction2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cool_button"
android:text="HiText2"
android:layout_below="@id/btnAction1"
/>
</LinearLayout>
use android:layout_marginTop="10dp"
Use android:layout_marginTop="10.0dip"
on second button.
use this code for your second button
<Buttonandroid:id="@+id/btnAction2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/cool_button"
android:text="HiText2"
android:layout_marginTop="15dp"
/>
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