Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
ashishjmeshram
Posts: 154
Registered: ‎01-08-2010
My Device: 8310 Rogers

Background image not covering the entire device display?

HI

 

We have given JPEG image image as the background image for all the screens in our application.

 

Bu in some screens where there is only one field, the background image does not cover the entire device screen. Image is displayed till that field only.

 

We have used custom layout manager as follows.

 

 

public class BaseLayoutManager extends VerticalFieldManager {

	private Bitmap bitmap = Bitmap.getBitmapResource("images/BG.jpg");

	public BaseLayoutManager(long style) {
		super(style);
	}

	// TODO Auto-generated constructor stub}

	protected void sublayout(int arg0, int arg1) {
		super.sublayout(arg0, arg1);
	}

	public void paint(Graphics graphics) {
		// Draw the background image and then call paint.
		graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(),
				bitmap, 0, 0);
		super.paint(graphics);
	}
}

 

 

 

Please help.

Developer
ankit2grover
Posts: 159
Registered: ‎08-19-2008
My Device: Not Specified

Re: Background image not covering the entire device display?

What are exactly you looking for ...........Are you looking for setting wallpaper of your screen with JPEG image............?

 

Change your sublayout method with this code....................

 

 protected void sublayout( int maxWidth, int maxHeight )
            {              
 
                super.sublayout(  Display.getWidth(), Display.getHeight());
               setExtent(  Display.getWidth(), Display.getHeight());
            }

Developer
ashishjmeshram
Posts: 154
Registered: ‎01-08-2010
My Device: 8310 Rogers

Re: Background image not covering the entire device display?

Thanks.   It did work. 

 

I have one more question though. Currently it seems that the image width and height is greater than the display width and height due to which i get image does not fit properly in whole display area.

 

Can we make it such that image fits in display area?

 

I tried using Display.getWidth() and Display.getHeight() but it did not work.

 

Developer
ankit2grover
Posts: 159
Registered: ‎08-19-2008
My Device: Not Specified

Re: Background image not covering the entire device display?

Reduce your image's width & height to width & height of your screen..........................Need to change image's dimensions to screen's dimensions