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.

Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd
Accepted Solution

show text and image horizontal

hi. i have label which contains text the text for the label is static and i have image which is also static 
i want to show both horizontally ,, i'm using the below code. i have check in 9780 device it is working fine but it is looking fine in 9700 simulator i mean the text in label is showing half, but worked fine in 9780, i'll post my 9780 device screen shot and i'll post my code and please tell me the below code is ok or not ?

HorizontalFieldManager Psrofhfm = new HorizontalFieldManager();
			LabelField psrolabel = new LabelField("Sanjay Tandon and his wife Priya have together compiled and published five books, each containing 52 Inspirational short stories. They are Sunrays for Sunday, Sunrays for Monday, Sunrays for Tuesday, Sunrays for Wednesday, Sunrays for Thursday. All these books were blessed by Bhagwan Sri Sathya Sai Baba. Sunrays for Sunday is available in Hindi too. Sunrays for Sunday and Sunrays for Monday are available in Telugu as well.Sanjay Tandon has also written the biography of his father, “Balramji Dass Tandon- Ek Prerak Charitra”. This book was released by Sh. L. K. Advani, the then Leader of Opposition in a programme presided over by Sh. Parkash Singh Badal, Chief Minister, Punjab.Sanjay Tandon has for the last more than 10 years been sending a one-liner Inspirational thought to about 2500 people by email. Since about 3 years this service is being done daily through SMS too."){
				protected void layout(int width, int height) {
			        super.layout(240, height);
			        //this.setExtent(240, height);
			Bitmap psrbit1=Bitmap.getBitmapResource("Literaryy.png");
			Bitmap psrscalingBitmap1=new Bitmap(230,400);//Then it sets the image according to your required width and height;
			psrbit1.scaleInto(psrscalingBitmap1, Bitmap.FILTER_LANCZOS); 
			BitmapField psrfieldDemo1 = new BitmapField(psrscalingBitmap1);  
			psrolabel.setMargin(10, 0, 0, 10);
			psrfieldDemo1.setMargin(20, 0, 0, 0);


Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: show text and image horizontal

Sorry, I don't understand the question.  Can you please try to ask the question another way?


I would have thought that specifying the width as a hard coded number would not be advisable if you expect your code to be used on many different screen sizes.  So I would suggest you set the width of your LabelField and the image dependent on the width of the device being used, rather than hard coding values suitable for the 9700 screen size. 

Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: show text and image horizontal

ok, i got your point