1
J'ai écrit le code suivant ici l'image d'arrière-plan affiche, mais l'image ne couvrait pas le plein fondComment définir l'image de fond fitable en application BlackBerry
private Bitmap background;
int mWidth = Display.getWidth();
int mHeight = Display.getHeight();
public MyScreen()
{
// Set the displayed title of the screen
//backgroundBitmap = Bitmap.getBitmapResource("slidimage.png");
final Bitmap background = Bitmap.getBitmapResource("slidimage.png");
HorizontalFieldManager vfm = new HorizontalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH) {
public void paint(Graphics g) {
g.drawBitmap(0, 0,mWidth, mHeight, background, 0, 0);
super.paint(g);
}
};
add(vfm);
Vous devez à l'échelle (étirement) Bitmap avant de tirer. Cochez cette réponse, http://stackoverflow.com/a/2268027/431639. 'public static Bitmap resizeImage()' résoudra votre problème. Lisez également la documentation de l'API, 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. – Rupak