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: 11
Registered: ‎07-22-2010
My Device: Curve
My Carrier: Verizon

Transparent VerticalFieldManager background

My goal is to have a splash screen with an animated gif 80 pixels below center of the screen.  Loading the screen's background image and animated gif is easy, as is positioning the animated gif 80px below center.  My problem is that the VerticalFieldManager background (which contains the animated gif field) is filled with all white (by default).  I can set the manager's background color, but the screen's background image isn't just one solid color.

 

 

public final class SplashScreen extends MainScreen {
  public SplashScreen() {
    // create and load the background image BitmapField
    this.add(backgroundImage);

    // create and load the progress bar
    BitmapField progressBar = new BitmapField(progressBarImage, Field.FIELD_HCENTER | Field.USE_ALL_WIDTH | Field.NON_FOCUSABLE);

    VerticalFieldManager manager = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.FIELD_HCENTER) {
      protected void sublayout(int maxWidth, int maxHeight) {
        // positioning code...
      }
    };

    manager.add(progressBar);
    this.setStatus(manager);
  }
}

 

 

I've tried various subpaint() overrides to set the Graphics, but can't seem to set anything other than a solid color.  Calling setGlobalAlpha() doesn't have the desired results either (as noted in other posts).

 

Any thoughts?

Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Transparent VerticalFieldManager background

You can always add clear background to your image. You would have to have different sizes for different screen sizes.

Contributor
Posts: 11
Registered: ‎07-22-2010
My Device: Curve
My Carrier: Verizon

Re: Transparent VerticalFieldManager background

I have a method that properly crops the background image based on the device screen's width and height.  To clarify, the background image field is added to the screen first (and is in the far back layer), then the VFM which contains the bitmap field is added to the screen.  I've also tried using 'setStatus(progressBarManager)' which gives the same results.

Highlighted
Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Transparent VerticalFieldManager background

You can override the paint method and call paint directly on the fields using paintChild.