在 BlackBerry 中禁用垂直滚动
在黑莓手机中,我开发了一个显示尺寸图像的屏幕 480 X 360 背景。我的 BB 屏幕尺寸为 480 X 360。由于当我垂直滚动时图像尺寸有点大,屏幕会滚动并干扰我的屏幕。
我想锁定滚动,这样我就无法进行垂直滚动。
我的代码如下:
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");
VerticalFieldManager 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);
}
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");
VerticalFieldManager 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);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加以下代码作为函数声明的下一行
super(NO_VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
add the below code as the next line of the function declaration
super(NO_VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
如果您已将图像放置在管理器中,那么您可以遵循任何想法:
1)创建一个自定义管理器并在其子布局方法中写入 setExtent(480,360) 。
2)您还可以在任何 HorizontalfieldManager 或 VerticalFieldManager 的子布局方法中编写 setExtent(480,360)
您是否尝试过在任何管理器中使用 USE_ALL_WIDTH 和 USE_ALL_HEIGHT ?
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?