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
Posts: 153
Registered: ‎09-03-2009
My Device: Not Specified
Accepted Solution

How to show image transparent part

I have a image, and use it as a custome search box. This image has transparent border. But it always show the white border.

How i can get the it correctly?The screenshot like this:XCDSGU9P}}88JZTS64CF(~T.jpg

 

Developer
Posts: 153
Registered: ‎09-03-2009
My Device: Not Specified

Re: How to show image transparent part

The search box code like below:

public class Searchbox extends Manager {
    private EditField editField;
    private Bitmap searchbarBitmap;
    private int searchbarheight;
    public Searchbox() {
        super(NO_VERTICAL_SCROLL);
        editField = new EditField(TextField.NO_NEWLINE);
        add(editField);
        searchbarheight = getFont().getHeight() + 10;
        searchbarBitmap =Scaleimage.resizeBitmap("Bold/fake_search_bar.png", Display.getWidth(), searchbarheight);
    }

    protected void sublayout(int width, int height) {
        Field field = getField(0);
        layoutChild(field, searchbarBitmap.getWidth(), searchbarBitmap
                .getHeight());
        setPositionChild(field, 30, 5);
        setExtent(searchbarBitmap.getWidth(), searchbarBitmap.getHeight());
    }

    protected void paint(Graphics graphics) {
        graphics.clear();
        graphics.drawBitmap(0, 0, searchbarBitmap.getWidth(), searchbarBitmap
                .getHeight(), searchbarBitmap, 0, 0);
        super.paint(graphics);
    }

    protected void applyTheme(Graphics arg0, boolean arg1) {
    
    }

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to show image transparent part

where are you displaying it? in an uiapplication all backgrounds are white.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 33
Registered: ‎01-19-2010
My Device: RIM Storm
My Carrier: Verizon

Re: How to show image transparent part

Developer
Posts: 153
Registered: ‎09-03-2009
My Device: Not Specified

Re: How to show image transparent part

Yes. The background of this app is white.

But to make the transparent show correctly. How to remove the background and set it transparent?

Thank you very much

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to show image transparent part

it is not possible to remove the white background of an uiapplication.

 

you can use an application and display your screen as a global screen without this limitation.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 153
Registered: ‎09-03-2009
My Device: Not Specified

Re: How to show image transparent part

Sorry . i am not really understand it

You mean i can use the method like this: pushGlobalScreen(defaultScreen, 0, GLOBAL_SHOW_LOWER);

But it can not get the transparent part . also get the white border

Thanks

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to show image transparent part

if you have an uiapplication you have the white background.

use an application and you can use transparent images without a white background.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 153
Registered: ‎09-03-2009
My Device: Not Specified

Re: How to show image transparent part

I am sorry.  I don't know how to implement that as you said.

A uiapplication , screen , and this searchbox

Screen add this searchbox and uiapplication push this screen

How to use application class?

Thanks very much.

Developer
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: How to show image transparent part

Hi guys, sorry for my interruption. Try this link, i think this will be useful to you

http://supportforums.blackberry.com/t5/Java-Development/Creating-Borderless-Popup-screen/m-p/411486#...

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------