0
我用了一些代碼,我從另一個問題找到。我注意到了setPositionChild()
部分,因爲我不確定要爲positionY
和positionX
投放什麼值。當我運行應用程序時,背景圖像位於頂部,稍後添加到管理器的按鈕全部在圖像底部一起推送。如何修復排列的背景圖像? (黑莓)
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);
其實我現在明白你的意思了。我刪除了添加imageField,它以我想要的方式工作。 – Paul