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
Highlighted
Developer
Posts: 53
Registered: ‎01-12-2011
My Device: BOLD 9780
My Carrier: Bharti Airtel
Accepted Solution

setGlobalAlpha() won't work on OS 7

Hi

I am using Custom LabelField with Transparent background

 i am using paintBackground(Graphics g) method to make background transparent as shown below

 

public void paintBackground(Graphics g) {
            g.setBackgroundColor(Color.WHITE);
            g.setGlobalAlpha(0);
            g.clear();
            super.paint(g);
        }
public void paint(Graphics g) {
            g.setColor(color);
            g.setGlobalAlpha(255);
            super.paint(g);
        }

 but when i tried to port my app on OS 7

I am getting black background with no text

What could be the Possible solution for this?

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: setGlobalAlpha() won't work on OS 7

Hello silwar,

 

For a transparent background, have you thought of combining LabelField.setBackground() with BackgroundFactory.createSolidTransparentBackground()?

 

No overriding of paint methods required.

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.