在BlackBerry中,我开发了一个屏幕,该屏幕在背景中显示了480 x 360的图像。我的BB屏幕的尺寸为480 x360。由于我垂直滚动屏幕被滚动并打扰我的屏幕时,图像的尺寸很大。

我想锁定滚动,使我无法进行垂直滚动。

我的代码如下:

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

}
有帮助吗?

解决方案

将以下代码作为函数声明的下一行添加

super(no_vertical_scroll | no_vertical_scrollbar);

其他提示

如果您将图像放置在经理中,那么您可以遵循任何想法,即:

1)要么创建自定义管理器,然后以其sublayout方法编写setExtent(480,360)。 2)您还可以在任何水平菲尔德曼纳人或verticalfieldmanager的sublayout方法中编写setExtent(480,360)

您是否尝试在任何经理中使用use_all_width和use_all_height?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top