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
Contributor
zaggaz
Posts: 16
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Vodaphone

Background scaling

Hi all,

 

How do I make a background to scale and fit the width of a screen?

I've done the following, which lets the background fit the width of the screen but it is not scaled so parts are cut out.

The background also repeats as I used USE_ALL_HEIGHT.

 

I just want a background image to scale to the width of the screen.

 

Please help...

 

public class newScreen extends MainScreen {
	Bitmap backgroundBitmap = Bitmap.getBitmapResource("background.png");

	Background bg = BackgroundFactory.createBitmapBackground(backgroundBitmap);
	public IntroStoryScreen() {
		VerticalFieldManager hfm = new VerticalFieldManager(
				VerticalFieldManager.USE_ALL_HEIGHT
						| VerticalFieldManager.USE_ALL_WIDTH);
		hfm.setBackground(bg);
		this.add(hfm);
}
}

 -James

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Background scaling

Do a search in this forum (see Search box top right) on scale or scaling, there are many other Threads that discuss this sort of issue. 

Please use plain text.
Contributor
zaggaz
Posts: 16
Registered: ‎04-08-2011
My Device: Torch 9800
My Carrier: Vodaphone

Re: Background scaling

Now that I've scaled the image to the display, the image is repeated vertically.

How can I overcome this?
Please use plain text.
Contributor
Pri-Machine
Posts: 37
Registered: ‎07-26-2011
My Device: Non Blackberry User
My Carrier: Non Blackberry User

Re: Background scaling

try using Repeat_None 

property of Background class

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Please press the kudos button (star icon) on the left side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
- Paresh Indulkar
(Game Programmer at Synqua Games)
(Developer of games - BBM Cricket with Friends & Word Poker with Friends :smileyvery-happy: )
Please use plain text.