<Button
android:id="@+id/o_pharmacy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/p2"
android:text="@string/o_pharmacy"
android:textSize="26sp" />
<Button
android:id="@+id/lab"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/lab"
android:text="@string/lab"
android:textSize="26sp" />
<Button
android:id="@+id/i_pharmacy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/p1"
android:text="@string/i_pharmacy"
android:textSize="26sp" />
I tried above code to display 3 buttons in Liner layout. It works but I need to put space between the two buttons.
The best is to use android:layout_marginTop="10dp" in your XML activity as this gives accurate spacing between that button and the other button or widget. Repeat this for rest of the buttons.
Use android:layout_marginTop="10.0dip" on second button.
android:layout_margin="10dp"
for each button
If the orientation of your LinearLayout is vertical, use
android:layout_marginTop="10dp"
otherwise, use
android:layout_marginLeft="10dp"
<Button
android:id="@+id/o_pharmacy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/p2"
android:text="@string/o_pharmacy"
android:textSize="26sp" />
<Button
android:id="@+id/lab"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="25dp"
android:drawableLeft="@drawable/lab"
android:text="@string/lab"
android:textSize="26sp" />
<Button
android:id="@+id/i_pharmacy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="25dp"
android:drawableLeft="@drawable/p1"
android:text="@string/i_pharmacy"
android:textSize="26sp" />
Try this.
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