[英]Remove space between buttons
i have bunch of buttons within linear layout. 我在线性布局中有一堆按钮。 But there is spaces buttons.
但是有空格按钮。 I set padding as 0 but there no change.
我将填充设置为0但没有变化。 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.
有人在http://www.mail-archive.com/android-developers@googlegroups.com/msg51104.html上遇到了同样的问题但在那里没有回答。 Can you plese help me.
你能帮助我吗?
Try to play with android:layout_margin
attribute. 尝试使用
android:layout_margin
属性。 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. 如果你的意思是你希望它们被推到边缘,像素为像素,你需要使用自己的9补丁作为按钮背景,因为Android中的默认补丁在边框周围有一些额外的像素。它的9补丁背景。 For an example of this, look at the file in your SDK folder under:
有关此示例,请查看SDK文件夹中的文件:
platforms/android-8/data/res/drawable-hdpi/btn_default_transparent_normal.9.png
For example, this is what I get with the default: 例如,这是我使用默认值得到的:
And with a custom 9-patch I had made earlier: 我使用之前制作的自定义9补丁:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.