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
New Contributor
LSK1
Posts: 2
Registered: ‎06-17-2012
My Device: 9550

Background image causes scrolling

Hi All,

 

I have added a background image to VerticalFieldManager . 

 

VerticalFieldManager verticalFieldManager = new VerticalFieldManager(

VerticalFieldManager.USE_ALL_WIDTH
| VerticalFieldManager.USE_ALL_HEIGHT) {

 

// Override the paint method to draw the background image.
public void paint(Graphics graphics) {
// Draw the background image and then call paint.
graphics.drawBitmap(0, 0, getWidth(), getHeight(), image, 0, 0);
super.paint(graphics);
}

};

 

Now when I add this manager to my screen then it causes the scroll arrows to come on right top and bottom of screen although the image perfectly fits the dislayable area. When I scroll down it simply scrolls down indefinately and shows a white screen (the background image which I using has Blue color).

 

If I remove VerticalFieldManager.USE_ALL_HEIGHT , then the image does not show unless I add some componenets in this field manager.

 

Not sure whats going on.

 

Thanks !

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

Re: Background image causes scrolling

I think you need to add NO_VERTICAL_SCROLL.

 

But I think this is all expained in this KB article, which I suggest you review. 

http://supportforums.blackberry.com/t5/Java-Development/MainScreen-explained/ta-p/606644

New Contributor
LSK1
Posts: 2
Registered: ‎06-17-2012
My Device: 9550

Re: Background image causes scrolling

Thanks it worked but now when the keyboard is up I cannot see fields which are below the keyboard.

 

How do I overcome this ?

 

Thanks and Regards.

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: Background image causes scrolling

I suggest you try creating MainScreen with NO_VERTICAL_SCROLL and your VerticalFieldManager displaying the background with USE_ALL_HEIGHT and VERTICAL_SCROLL. See if that helps.

 

In fact, that is pretty much what was suggested in the article Peter quoted, though I never fully spelled it out there. I don't guarantee it will work as you want it to - the way virtual keyboard works is a puzzle at times :smileyhappy:

 

Good luck!

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!