我是黑莓新手,我正在开发一个黑莓应用程序,我在其中创建一个登录屏幕,其中一个白色条形图像放在顶部,徽标应该出现在该条带上。所以我只需要为它取两个horizontalFieldManager,对于条带,它会显示良好但标志位于条带下方。
这是我的代码::
((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(0xEDEDED));
HorizontalFieldManager hfm = new HorizontalFieldManager(Field.FIELD_VCENTER );
HorizontalFieldManager hfm2 = new HorizontalFieldManager(Field.FIELD_VCENTER );
Bitmap Topstrip = new Bitmap(Display.getWidth(), Display.getHeight());
Bitmap MoneLogo = new Bitmap(Display.getWidth(), Display.getHeight());
boolean lowRes = Display.getWidth() <= 320;
if (lowRes)
{
// The device has a low resolution screen size
Topstrip = Bitmap.getBitmapResource("topstripbg.png");
}
else
{
Topstrip = Bitmap.getBitmapResource("topstripbg-mdpi.png");
MoneLogo= Bitmap.getBitmapResource("logo72X72.png");
// The device has a high resolution screen size
}
BitmapField TopstripimgField = new BitmapField(Topstrip);
BitmapField MoneLogoimgField = new BitmapField(MoneLogo);
hfm.add(TopstripimgField);
hfm2.add(MoneLogoimgField);
add(hfm);
add(hfm2);
我想要这样::
--------------------------------------
____
|LOGO| ** Strip **
|____|
--------------------------------------
还请建议我使用最佳实践的UI教程
更新
答案 0 :(得分:2)
试试这个 -
final Bitmap bg=Bitmap.getBitmapResource("background.png");
VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){
public void paint(Graphics graphics) {
graphics.setBackgroundColor(Color.WHITE);
graphics.clear();
graphics.drawBitmap(0, 0, bg.getWidth(),
bg.getHeight(), bg, 0, 0);
super.paint(graphics);
}
};
final Bitmap logo= Bitmap.getBitmapResource("logo.png");
top .add(new BitmapField(logo));
add(top);