我有一个背景图像的画面渲染,像这样:黑莓 - 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已经改变。 –