在 BlackBerry 中禁用垂直滚动

发布于 2024-10-12 06:07:09 字数 1506 浏览 2 评论 0原文

在黑莓手机中,我开发了一个显示尺寸图像的屏幕 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白云悠悠 2024-10-19 06:07:09

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

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

椵侞 2024-10-19 06:07:09

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

1)创建一个自定义管理器并在其子布局方法中写入 setExtent(480,360) 。
2)您还可以在任何 Horizo​​ntalfieldManager 或 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文