Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove space between buttons

Tags:

java

android

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.

like image 471
csfcse Avatar asked Dec 05 '10 21:12

csfcse


2 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:

<Button
    android:layout_marginLeft="-3dip"
    android:layout_marginRight="-3dip"
    ... />
like image 76
Vit Khudenko Avatar answered Sep 17 '22 21:09

Vit Khudenko


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:

platforms/android-8/data/res/drawable-hdpi/btn_default_transparent_normal.9.png

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

alt text

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

alt text

like image 40
Kevin Coppock Avatar answered Sep 21 '22 21:09

Kevin Coppock