gpt4 book ai didi

java - 将图像设置为第二个图像

转载 作者:行者123 更新时间:2023-11-30 04:43:25 24 4
gpt4 key购买 nike

我是黑莓新手,我正在开发一个黑莓应用程序,在其中我制作一个登录屏幕,其中一个白色 strip 图像放置在顶部, Logo 应出现在该 strip 上。所以我简单地为它准备了两个horizo​​ntalFieldManager,对于 strip ,它会显示良好,但 Logo 保留在 strip 下方。

这是我的代码::

((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 教程以实现最佳实践

更新:

enter image description here

最佳答案

试试这个 -

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

关于java - 将图像设置为第二个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11682795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com