2010-07-30 75 views
0

需要關於MainScreen中繪畫方法的幫助信息。使用上面的代碼,我試圖呈現一些列表。它工作正常。但它隱藏了我使用setStatus()方法添加的所有狀態欄圖標。當我刪除繪畫方法時,狀態欄中的按鈕顯示出來。我也嘗試過使用setRe g.pushRegion(),但沒有運氣。狀態按鈕在BlackBerry中被覆蓋繪畫方法隱藏

下面是示例代碼:

private void addStatusBar(){ 
    manager = new HorizontalFieldManager(); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("ask.jpg"))); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("experts.jpg"))); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("search.jpg"))); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("my_profile.jpg"))); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("groups.jpg"))); 
    manager.add(new BitmapField(ImageUtility.loadBitMap("analitics.jpg"))); 

    setStatus(manager); 

} 

protected void paint(Graphics graphics) { 
    //graphics.pushRegion(new XYRect(0, 0, getPreferredWidth(), getPreferredHeight())); 
    Bitmap image = ImageUtility.loadBitMap("header2.jpg"); 
    graphics.drawBitmap(0, 0, 500, image.getHeight(), image, 0, 0); 

    for(int i =0; i < 5; i++){ 
     fieldList.drawListRow(fieldList, graphics, i, 50 + (i*50), 20);   
    } 
} 

回答

0

你有沒有嘗試設置「Y」爲graphics.drawBitmap偏移()調用狀態欄的高度?

0

你需要調用super.paint否則狀態永遠不會被繪製。

0
protected void paint(Graphics graphics) { 
Bitmap image = ImageUtility.loadBitMap("header2.jpg"); 
graphics.drawBitmap(0, 0, 500, image.getHeight(), image, 0, 0); 
for(int i =0; i < 5; i++){ 
    fieldList.drawListRow(fieldList, graphics, i, 50 + (i*50), 20);   
}  
super.paint(graphics); }