Blackberry - set field background image stetched to fit

本秂侑毒 提交于 2020-03-03 15:56:13

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!