Hello BB experts,
I am programmatically drawing the background image(320*480 size) for my application home screen as below. Screen does have scrollbar facility added. Also screen is having many other controls too like Label, EditField etc in multiple horizontal manager.
My problem is, when i scroll down the screen, the background image is not occupying into the below scrolled portion too, instead i'm seeing white normal background. It doesn't look good. So i want to know how can i place the background image even when the screen is scrolling down?
public MyHomescreen()
{
super();
LabelField appTitle = new LabelField ("MyApp Title");
setTitle(appTitle);
background = Bitmap.getBitmapResource ("HomeScreen.png");
_container = new VerticalFieldManager( Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR ) {
protected void paint( Graphics g )
{
int y = MyHomescreen.this.getMainManager().getVerticalScroll();
g.clear();
g.drawBitmap( 0, 0, background.getWidth(),
background.getHeight(), background, 0, 0 );
super.paint( g );
}
protected void sublayout( int maxWidth, int maxHeight )
{
int width = background.getWidth();
int height = background.getHeight();
super.sublayout( width, height);
setExtent( width, height);
}
};
mainVerticalManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR)
{
protected void sublayout( int maxWidth, int maxHeight )
{
int width = background.getWidth();
int height = background.getHeight();
super.sublayout( width, height);
setExtent( width, height);
}
};
// code to add manager into the screen etc..
}