回答

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); 

你可以改變顏色邊框也