L
L
Linar Badrtdinov2016-08-19 14:00:42
Android
Linar Badrtdinov, 2016-08-19 14:00:42

How to remove padding between buttons in android?

Several buttons are sequentially inserted into a LinearLayout. I set the parameter: android:layout_margin="0dp"
But some minimum indent between the buttons still remains. And I want to make the buttons stick together. If you use an ImageButton, then the padding disappears completely, but this does not happen with the Button.
c77ddadcb93d4dc9b1b6e6c8452220c8.png

<LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/linearLayout"
        android:layout_margin="0dp">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="25"
            android:id="@+id/button7"
            android:layout_margin="0dp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="35"
            android:id="@+id/button6"
            android:layout_margin="0dp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="50"
            android:id="@+id/button8"
            android:layout_margin="0dp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="80"
            android:id="@+id/button9"
            android:layout_margin="0dp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="100"
            android:id="@+id/button10"
            android:layout_margin="0dp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="П1"
            android:id="@+id/button11"
            android:layout_margin="0dp" />
    </LinearLayout>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-08-19
@LineAir

In general, this problem is background, by default there are no backgrounds in the background, in the shap itself
you need to change the background, read about selectors and create your own
link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question