Home » Android » java – Remove space between buttons

java – Remove space between buttons

Posted by: admin June 15, 2020 Leave a comment


i have bunch of buttons within linear layout. But there is spaces buttons. I set padding as 0 but there no change.
There is someone who already had the same problem at http://www.mail-archive.com/[email protected]/msg51104.html but no answer at there.
Can you plese help me.

How to&Answers:

Try to play with android:layout_margin attribute. For instance, to reduce space on the left/right side (assuming you have a horizontal set of buttons) you can do smth like this:

    ... />


I’ll refer you to a previous answer I gave on this:

If you’re meaning you want them to be pushed to the edge, pixel for pixel, you’ll need to use your own 9-patch for the button background, as the default one in Android has a few extra pixels around the border of its 9-patch background. For an example of this, look at the file in your SDK folder under:


For example, this is what I get with the default:

alt text

And with a custom 9-patch I had made earlier:

alt text