我想在屏幕底部添加一个带有图像和字符串的栏,我希望间距相同
img1 string img2|img3 ,这就是底栏的样子,下面的代码没有正常工作,我正在对齐,最后一个 iamge 正在消失。
HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager(
FIELD_BOTTOM) {
public void paint(Graphics graphics) {
graphics.setBackgroundColor(0x316AC5);
graphics.clear();
super.paint(graphics);
}
};
Bitmap fadeBitmap = Bitmap
.getBitmapResource("GE_TimeZone_Fade_blue.PNG");
Bitmap clockBitmap = Bitmap.getBitmapResource("GE_Cal_icon_blue.PNG");
Bitmap tzBitmap = Bitmap
.getBitmapResource("GE_TimeZone_Button_blue.PNG");
final ImageButtonField unfocus = new ImageButtonField("",
Field.FOCUSABLE | FIELD_LEFT, "GE_TimeZone_Fade_blue.PNG",
"GE_TimeZone_Fade_blue.PNG", 0xFFFFFF);
LabelField test = new LabelField("hello");
final ImageButtonField bitmapField = new ImageButtonField("",
Field.FOCUSABLE | FIELD_HCENTER, "GE_Cal_icon_blue.PNG",
"GE_Cal_icon_onSelect.PNG", 0xFFFFFF);
final ImageButtonField bitmapField1 = new ImageButtonField("",
Field.FOCUSABLE | FIELD_RIGHT, "GE_TimeZone_Button_blue.PNG",
"GE_TimeZone_Btn_OnSelect.PNG", 0xFFFFFF);
int margin = ((Display.getWidth() - (fadeBitmap.getWidth()
+ clockBitmap.getWidth() + tzBitmap.getWidth() + test
.getWidth())) / 4);
unfocus.setMargin(0, margin, 0, 0);
test.setMargin(0, margin, 0, 0);
bitmapField.setMargin(0, margin, 0, 0);
bitmapField1.setMargin(0, margin, 0, 0);
horizontalFieldManager.add(unfocus);
horizontalFieldManager.add(test);
horizontalFieldManager.add(bitmapField);
horizontalFieldManager.add(bitmapField1);
this.setStatus(horizontalFieldManager);