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
Posts: 20
Registered: ‎05-17-2012
My Device: have no device
My Carrier: KievStar

Image on the background of label.

i could add image but can't make it resizable and can't make it in the background(((

 

Bitmap imageBitmap = Bitmap.getBitmapResource("rectangle.png");
BitmapField bitmapField = new BitmapField(imageBitmap, BitmapField.FIELD_HCENTER);
add(bitmapField);

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Image on the background of label.

Basically, the BB does not allow one field on top of another field in the same screen.

 

The simplest way is to set the bitmap as the background using the setBackground function.

 

You can set the bitmap as the background of the field, containing manager or the screen.

 

Hope that helps,

 

E.

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

Re: Image on the background of label.

Just adding to the previous answer, you noted:

"can't make it resizable"

 

This is correct, BB does not automatically resize Bitmaps, you will have to do this yourself.  There are scaling functions available, see Bitmap Object.  If you have a transparent image, you might want to look at this:

http://supportforums.blackberry.com/t5/Java-Development/Resizing-Transparent-Bitmaps/ta-p/703239