我试过这个却无法实现。我使用justifiedfieldmanager只买2个标签。我使用了horizontalfieldmanager但它不能像这样对齐它。我只是坚持了如何在黑莓中获得这种类型的布局!任何帮助都非常感谢!
谢谢!
答案 0 :(得分:0)
有几种方法可以实现这一点,我建议您使用AbsoluteFieldManager
//--------this is your toolbar AbsoluteFieldManager
AbsoluteFieldManager _fieldManagerBottom;
_fieldManagerBottom = new AbsoluteFieldManager();
////------------
///--here you add the background image to your toolbar
BitmapField BgField = new BitmapField(BottombackgroundBitmap, Field.NON_FOCUSABLE);
_fieldManagerBottom.add(BgField);
////then you put your buttons and labels to the absolute manager at the position you want
CustumerBitmapButton yourButton;
yourButton = new CustumerBitmapButton (yourButtonBitmap,60,60,Field.FOCUSABLE);
_fieldManagerBottom.add(yourButton ,260,0);
答案 1 :(得分:0)
我刚刚找到解决方案:
HorizontalFieldManager hfm = new HorizontalFieldManager();
final ImageButton home = new ImageButton("",Field.FOCUSABLE, "home.png","home.png", 0x9cbe95);
final ImageButton add = new ImageButton("",Field.FOCUSABLE, "add.png","add.png", 0x9cbe95);
final ImageButton plus = new ImageButton("",Field.FOCUSABLE, "plus.png","plus.png", 0x9cbe95);
final ImageButton bin = new ImageButton("",Field.FOCUSABLE, "bin.png","bin.png", 0x9cbe95);
home.setMargin(0,0,0,50);
其他人也有类似的setmargins !!
答案 2 :(得分:0)
请注意,如果您在不同的分辨率设备上使用应用,这会给您带来麻烦。所以你应该通过检查设备分辨率来实现这一点。
if(Display.getWidth>320)
setMargin(0,0,0,intFor320);
else
setMargin(0,0,0,intForLessThan320);