回答

0

说你的TimerTask递增scrollAmount命名INT currentScroll

你必须处理的自定义字段的paint方法的图像。这里是一个图像的为例滚动(如果图像是屏幕大):

Bitmap bmp = this.getBitmap1(); 
int width = bmp .getWidth(); 
graphics.drawBitmap(0, 0, width , bmp.getHeight(), bmp, currentScroll, 0) 
+0

感谢Hithredin的年代,我这样做。我不需要像'MarqueeLabel extends LabelField'被调用一次那样,为3个图像调用我的'CustomBitmapField extends BitmapField' 3次吗? 'MarqueeLabel'包含整个标签,所以它在一次调用'super()'时被绘制,但是在这里我有3个位图。如果我需要调用它1次,那么如何调用'super(bitmap)'? (请参阅滚动字幕文本的上述链接)。 – Shreyas

+0

嘿,它的滚动,但'onFocus()'和'onUnfocus()'的一些例外。我从那里调用'invalidate()'来改变一些边界效果,同时集中注意力。我做对了吗?请纠正我。 – Shreyas

+0

你如何添加边框?在这种自定义的状态下,我建议在绘制方法(graphics.drawFillREct类似的东西)中绘制边框,具体取决于你是否有焦点。 – Benoit

0
BitmapField imageField = new BitmapField(Bitmap.getBitmapResource("sync.png"), 
       Field.FOCUSABLE); 

Border imageFieldBorder = BorderFactory.createBevelBorder(edges, new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,Color.BLACK), new XYEdges(Color.WHITESMOKE, Color.WHITESMOKE,Color.WHITESMOKE, Color.WHITESMOKE)); 


imageField.setBorder(imageFieldBorder); 

你可以改变颜色边框也