我添加了3个图像在3 BitmapFields在一个HFM。它用滚轮水平滚动,但我想让图像像字幕一样自动滚动。我得到了display scroll text like marquee的线程,但是如何用图片替换它呢?
发布于 2012-08-29 17:29:10
假设您的TimerTask递增名为int currentScroll的scrollAmount
您必须在自定义字段的paint方法中处理图像。这里有一个滚动图片的例子(如果图片比你的屏幕大):
Bitmap bmp = this.getBitmap1();
int width = bmp .getWidth();
graphics.drawBitmap(0, 0, width , bmp.getHeight(), bmp, currentScroll, 0)发布于 2012-08-31 18:29:31
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);你也可以改变边框的颜色
https://stackoverflow.com/questions/12173025
复制相似问题