我已經試過這個,但無法實現。我用justifiedfieldmanager購買它只有2個標籤。我用horizontalfieldmanager,但它不能像這樣對齊。我只是堅持如何在黑莓手機中獲得這種佈局!任何幫助真的很感激!
謝謝!
我已經試過這個,但無法實現。我用justifiedfieldmanager購買它只有2個標籤。我用horizontalfieldmanager,但它不能像這樣對齊。我只是堅持如何在黑莓手機中獲得這種佈局!任何幫助真的很感激!
謝謝!
我只是找到了解決辦法:
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!
有兩種方法可以實現這一點,我勸你這一個使用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);
請注意,如果您在不同的分辨率設備上使用您的應用程序,這會給您帶來麻煩。所以你應該使用設備分辨率檢查來照顧這一點。
if(Display.getWidth>320)
setMargin(0,0,0,intFor320);
else
setMargin(0,0,0,intForLessThan320);