如何创建Android中无余按钮栏 [英] How do I create marginless button bar in Android

查看:78
本文介绍了如何创建Android中无余按钮栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序在底部按钮栏,这是一个与此相似(摩托罗拉Defy +):

I want my application to have button bar at the bottom, that is similar to this one (Motorola Defy+):

如何才能实现这一目标?我试过按钮栏的风格在它常用按键,但他们总是有保证金在这种情况下。

How can this be achieved? I've tried ButtonBar style with regular buttons in it, but they always have margin in this case.

推荐答案

通过code:

请在酒吧的LinearLayout水平。 Let's说,它在code名称将是基线血铅。

Make the bar LinearLayout horizontal. Let´s say its name in code will be bbll.

LinearLayout.LayoutParams params = bbll.LayoutParams();
params.leftMargin=0;
params.rightMargin=0;
... or params.setMargins(0, 0, 0, 0);
bbll.setLayoutParams(params);

由布局简单地设置各边距为0。这就是全部。如果你做它,它不会工作,把code在这里,请。

By layout simply set each margin to 0. That's all. If you have done it and it won't work, put the code here, please.

但是,你应该设置 bbll.setPadding(0,0,0,0),太。或者,你会看到在酒吧之间(即不可见)和按钮空。 AQS具有良好的思想。

But you should set bbll.setPadding(0,0,0,0) , too. Or you'll see empty space between the bar (that is invisible) and the buttons. aqs has a good thought.

这篇关于如何创建Android中无余按钮栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆