2012-10-10 120 views
0

我已經搜索,但沒有找到任何解決方案,我只是它的創建問題。當我插入它說它非法的論點,並沒有開始。黑莓背景圖片?

Bitmap bitmap = Bitmap.getBitmapResource("Background.png"); 

this.getMainManager().setBackground(

      BackgroundFactory.createBitmapBackground(bitmap) 
     ); 

它不起作用。

感謝您的幫助!它的工作。

final Bitmap top = Bitmap.getBitmapResource("your background image.png"); 
final VerticalFieldManager top_ = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){ 

     public void paint(Graphics graphics) { 
      graphics.drawBitmap(0, 0, top.getWidth(), 
        top.getHeight(), top, 0, 0); 
      super.paint(graphics); 
     } 

    }; 

現在你所有的字段添加到這個top_ - 只是我的路徑

+0

想要將此字段添加到該圖片嗎? – Signare

+0

不,我只是想設置一個背景 –

+0

我的意思是會有標籤和這個背景的一些領域infront。 –

回答

1

TYY本的錯字錯誤。然後將top_添加到您的屏幕。如果沒有字段,則不會顯示背景圖像。所以不要忘記添加一些字段。

+0

我現在有許多不同佈局的領域。不能以另一種方式完成嗎?因爲我使用2或3個垂直和水平管理器。 :S我已經完成了16節課。我儘管在最後添加了背景。任何想法現在如何解決這個問題? –

+0

將所有項目添加到此VerticalFieldManager。然後將其添加到您的屏幕。 – Signare

+0

是它的工作,但它的一半。我怎樣才能達到100%的寬度和100%的身高? –