Reputation: 5672
Here is my layout
<LinearLayout
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/image"
android:layout_gravity="bottom"
android:layout_marginTop="5dp"
>
<Button
android:layout_weight="1.0"
android:id="@+id/button1"
style="@style/ActionButtonText"
android:background="@drawable/action_button_left"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:layout_weight="1.0"
android:id="@+id/button1"
style="@style/ActionButtonText"
android:background="@drawable/action_button_center"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:layout_weight="1.0"
android:id="@+id/button1"
style="@style/ActionButtonText"
android:background="@drawable/action_button_center"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:layout_weight="1.0"
android:id="@+id/button1"
style="@style/ActionButtonText"
android:background="@drawable/action_button_right"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
and this is how they look
What i am trying to do is remove gap between buttons so they look stuck together like this
I have played with padding and margins but couldn't get it working. How can I achieve it? Thanks
Upvotes: 0
Views: 1336
Reputation: 15847
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginTop="5dp" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp" <------ it will work....( minus 10)
android:layout_weight="1.0"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp"
android:layout_weight="1.0"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp"
android:layout_weight="1.0"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="Button" >
</Button>
</LinearLayout>
Upvotes: 1