Reputation: 22066
I am new in blackberry, i am developing one blackberry application in which i am make a login screen where one white strip image are placed at top and logo should appear on that strip. so simply i have take two horizontalFieldManager for it and for strip it will display good but logo are stay below at strip.
Here is my Code ::
((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);
I want like this ::
--------------------------------------
____
|LOGO| ** Strip **
|____|
--------------------------------------
Please also suggest me good UI Tutorial for best practice
Update:
Upvotes: 1
Views: 100
Reputation: 4158
try this -
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);
Upvotes: 2