我有一個背景圖像的畫面渲染,像這樣:黑莓 - Listfield透明排
bg = new VerticalFieldManager(
VerticalFieldManager.USE_ALL_WIDTH |
VerticalFieldManager.USE_ALL_HEIGHT |
VerticalFieldManager.NO_HORIZONTAL_SCROLLBAR |
VerticalFieldManager.NO_VERTICAL_SCROLLBAR |
VerticalFieldManager.NO_HORIZONTAL_SCROLL |
VerticalFieldManager.NO_VERTICAL_SCROLL) {
//Override the paint method to draw the background image.
public void paint(Graphics graphics) {
//Draw the background image and then call paint.
graphics.drawBitmap(Graphics.getScreenWidth()/2 - bgBitmap.getWidth()/2,
Graphics.getScreenHeight()/2 - bgBitmap.getHeight()/2,
bgBitmap.getWidth(), bgBitmap.getHeight(), bgBitmap, 0, 0);
super.paint(graphics);
}
};
add(bg);
然後我加入了屏幕這個經理的任何領域。我有一個ListField,我希望看到背景。當屏幕第一次呈現時,一切都很好。我可以看到圖像。只要我向下滾動,選擇一些內容並取消選擇它,背景消失(變成白色)。
在選擇顏色消失後,爲了使它們真正透明,在繪製我的列表行時是否需要做一些特別的事情?
注意:我發現無論在背景上繪製什麼字段,都會發生這種情況。它將正確顯示,直到爲給定的可對焦字段繪製選擇顏色,然後再選擇其他顏色。所有填充了選擇顏色的區域在取消選擇後變爲默認白色。
首先,非常感謝!這個解決方案完美地解決了我的一些問題。我只認爲onUnfocus()是必需的。我仍然遇到的問題是與ListField行。我嘗試覆蓋整個ListField的onUnfocus()以及我用來包含列表行但不包含骰子的單個TableRowManager對象。 –
還需要在drawListRow()函數和paint()函數中調用invalidate()方法。實際上,當UI更改時,需要調用invalidate()方法。當任何領域獲得焦點然後basiclly它畫一個藍色矩形,即Ui已經改變。 –