开发者

Remove space between buttons

开发者 https://www.devze.com 2023-01-29 12:38 出处:网络
i have bunch of buttons within linear layout. But there is spaces buttons. I set p开发者_如何学Pythonadding as 0 but there no change.

i have bunch of buttons within linear layout. But there is spaces buttons. I set p开发者_如何学Pythonadding as 0 but there no change. There is someone who already had the same problem at http://www.mail-archive.com/android-developers@googlegroups.com/msg51104.html but no answer at there. Can you plese help me.


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"
    ... />


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:

Remove space between buttons

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

Remove space between buttons

0

精彩评论

暂无评论...
验证码 换一张
取 消