Question

Dans BlackBerry j'ai développé un écran qui affiche une image de taille 480 X 360 en arrière-plan. Mon écran BB est de taille 480 x 360. Comme l'image est un peu grande taille lorsque je fais défiler verticalement l'écran est défilée et perturbe mon écran.

Je veux verrouiller le défilement tel que je ne pourrai pas faire le défilement vertical.

Code Ma est comme suit:

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

}
Était-ce utile?

La solution

ajouter le code comme ci-dessous la ligne suivante de la déclaration de fonction

super (NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);

Autres conseils

Si vous avez placé votre image à l'intérieur d'un gestionnaire alors u peut suivre une idée à savoir:

1) soit créer un gestionnaire personnalisé et SetExtent d'écriture (480360) dans sa méthode sublayout. 2) vous pouvez également écrire SetExtent (480360) dans toute méthode de sublayout de HorizontalfieldManager ou VerticalFieldManager

avez-vous essayé d'utiliser USE_ALL_WIDTH et USE_ALL_HEIGHT dans un gestionnaire?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top