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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Contributor
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

Developer
Posts: 19,636
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. 

Contributor
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?
Contributor
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 Smiley Very Happy )