0

Consider the following code and output:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/button1"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:text="A" />

    <Button
        android:id="@+id/button2"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:text="B" />

    <Button
        android:id="@+id/button3"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:text="C" />

</LinearLayout>

enter image description here

Because android:layout_margin="0dp", the buttons should touch each other, but this is not happening. Please explain this behavior. What can I do to eliminate the gap between the buttons?

siva636
  • 16,109
  • 23
  • 97
  • 135

1 Answers1

1

That is due the style applied to the button.
You can avoid that by setting android:background but you will loose the click effect and all .

Labeeb Panampullan
  • 34,521
  • 28
  • 94
  • 112