I want the background image to stretch all screen. I simply created a VerticalFieldManager and modified paint method.
verticalFieldManager = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH
| VerticalFieldManager.NO_HORIZONTAL_SCROLLBAR) {
public void paint(Graphics graphics) {
graphics.drawBitmap(0, 0, this.getWidth(), this.getHeight(),
backgroundBitmap, 0, 0);
super.paint(graphics);
}
};
And when i add a ListField to the verticalFieldManager and scroll, background image is not repaint. How can i repaint background when scroll?
Create
EncodedImage
from yourBitmap
, or even directly extractEncodedImage
from resources -EncodedImage.getEncodedImageResource("res/bg.png")
.Then use this to scale it:
Then you may draw the
EncodedImage
on theGraphics
object: