2010-05-26 55 views
0

有没有办法将重画回调添加到直播屏幕对象,即不是通过继承?挂钩在黑莓中重画事件


推理
我想从一个扩展插件SDK(代跳动位置:固定的)绘制的重叠,所以由bbwp存根创建的屏幕。

我可以

Ui.getUiEngine().getActiveScreen() 

得到它,就可以得出相当不错,但我需要一种方法在适当的时候进行重绘。



我已经放弃了办法覆盖推的屏幕,因为我不能使它透明/找到一种方法,通过传递事件。

回答

1

如果要覆盖推的屏幕上,你应该能够使它的背景透明通过重写paintBackground()方法如下:

// Make background transparent 
protected void paintBackground(Graphics graphics) { 
    XYRect xy = graphics.getClippingRect(); 
    graphics.pushContext(xy, 0, 0); 
    graphics.setGlobalAlpha(0); 
    graphics.setColor(0xffffff); 
    graphics.fillRect(xy.x, xy.y, xy.width, xy.height); 
    graphics.popContext(); 
} 

然后,通过,覆盖通过触摸事件下面的方法,并返回-1,如果你不想让你的屏幕处理触摸事件:

public int getFieldAtLocation(int x, int y) { 
    return -1; 
} 
+0

谢谢,我会试试明天 – Bendlas 2010-05-26 21:15:41