2012-10-12 64 views
0

enter image description here黑莓帮助对齐此布局

我已经试过这个,但无法实现。我用justifiedfieldmanager购买它只有2个标签。我用horizo​​ntalfieldmanager,但它不能像这样对齐。我只是坚持如何在黑莓手机中获得这种布局!任何帮助真的很感激!

谢谢!

回答

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!

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);

0

请注意,如果您在不同的分辨率设备上使用您的应用程序,这会给您带来麻烦。所以你应该使用设备分辨率检查来照顾这一点。

if(Display.getWidth>320) 
    setMargin(0,0,0,intFor320); 
else 
    setMargin(0,0,0,intForLessThan320);