In BlackBerry I have developed a screen which display a image of size 480 X 360 in background. My BB screen is of size 480 X 360. As the image is bit big in size when I scroll vertically the screen gets scrolled and disturbs my screen.
I want to lock the scrolling such that I will not be able to do vertical scrolling.
My code is as follows:
public LaunchXtcMsngrScreen()
{
int intwidth = Display.getWidth();
int intheight = Display.getHeight();
//getting the height/width of BB screen
Debugger.debug(UrlInfo.workflow_File,"Screen Height ="+intheight);
Debugger.debug(UrlInfo.workflow_File,"Screen Width ="+intwidth);
BMbackground = Bitmap.getBitmapResource("xtclogo.jpg");
VerticalFieldMan开发者_如何学JAVAager VFM = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH
| VerticalFieldManager.USE_ALL_HEIGHT
| VerticalFieldManager.NO_VERTICAL_SCROLL
| VerticalFieldManager.NO_VERTICAL_SCROLLBAR)
{
//Override the paint method to draw the background image.
public void paint(Graphics graphics)
{
//Draw the XTC Messenger logo
graphics.drawBitmap(0, 0,Display.getWidth(),Display.getHeight(),BMbackground, 0, 0);
super.paint(graphics);
}
};
Bitmap registerbitmap = Bitmap.getBitmapResource("register_button.PNG");
BFregister = new ImageButtonField(registerbitmap);
BFregister.setMargin(245,0,0,190);//vertical pos,0,0,horizontal pos
VFM.add(BFregister);
add(VFM);
}
add the below code as the next line of the function declaration
super(NO_VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
If you have placed your image inside a manager then u can follow any idea viz:
1) either create a custom manager and write setExtent(480,360) in its sublayout method. 2) you can also write setExtent(480,360) in any HorizontalfieldManager or VerticalFieldManager's sublayout method
have you tried using USE_ALL_WIDTH and USE_ALL_HEIGHT in any manager?
精彩评论