黑莓-设置字段背景图像以适应 [英] Blackberry - set field background image stetched to fit
问题描述
如何缩放图像-无论是使用Bitmap还是EncodedImage来填充字段的整个宽度和高度?
How can you scale an image - whether it be using Bitmap or EncodedImage to fill the entire width and height of a field?
尝试过:
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);
}
推荐答案
This questn is asked before here is link Blackberry - how to resize image?
在OS 5.0中,api scaleInto方法在位图类中提供,即
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
对于低于OS 5.0,此bb kb文章将有助于图像处理 http://supportforums.blackberry. com/t5/Java-Development/Rotate-and-scale-bitmaps/ta-p/492524
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
这篇关于黑莓-设置字段背景图像以适应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!