问题
How can you scale an image - whether it be using Bitmap or EncodedImage to fill the entire width and height of a field?
Tried this:
protected void paintBackground(Graphics g) {
super.paintBackground(g);
//try bitmap
//g.drawBitmap(0, 0, this.getWidth(), this.getHeight(), image 0, 0);
//try encoded image
g.drawImage(0, 0, this.getContentWidth(), this.getContentHeight(), image, 0, 0, 0);
}
回答1:
This questn is asked before here is link Blackberry - how to resize image?
In OS 5.0 the api scaleInto method is provided in Bitmap class i.e http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/system/Bitmap.html#scaleInto%28net.rim.device.api.system.Bitmap,%20int%29
For Below OS 5.0 this bb kb article will be helpful for image manipulations http://supportforums.blackberry.com/t5/Java-Development/Rotate-and-scale-bitmaps/ta-p/492524
来源:https://stackoverflow.com/questions/5009270/blackberry-set-field-background-image-stetched-to-fit