2011-07-25 37 views
0

我用了一些代碼,我從另一個問題找到。我注意到了setPositionChild()部分,因爲我不確定要爲positionYpositionX投放什麼值。當我運行應用程序時,背景圖像位於頂部,稍後添加到管理器的按鈕全部在圖像底部一起推送。如何修復排列的背景圖像? (黑莓)

Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("Background.JPG")); 
    Bitmap bmp = Bitmap.getBitmapResource("Background.JPG"); 
    BitmapField imgField = new BitmapField(bmp); 
    // Create the field manager 
    VerticalFieldManager manager = new VerticalFieldManager() 
    { 
     // Overide the sublayout of the field manager to set the position of 
     // the image directly 
    /* protected void sublayout(int width, int height) 
     { 
     setPositionChild(imgField, positionX, positionY) 
     setExtent(width, height) 
     }*/ 
    }; 
    // Set the background of the field manager 
    manager.setBackground(bg); 
    // add the bitmap field to the field manager 
    manager.add(imgField); 
    // add the field manager to the screen 
    add(manager); 

回答

0

請在此提及您要達到的目標。你期望的行爲是什麼?查看代碼時,應該按照您在運行應用程序時提到的那樣定位子字段。由於您正在向經理添加BitmapField(imageField),然後可能會向經理添加按鈕(未在代碼中顯示,假設您將其添加到代碼中的其他位置)。因此,提供更多關於你想達到的細節?

+0

其實我現在明白你的意思了。我刪除了添加imageField,它以我想要的方式工作。 – Paul