I have a gridfield and i am adding contents to ir. The problem is that the items scroll beyond the gridfield layout. I want the items to be within the gridfield and not go beyond it. Below is the code snippet.
gridbackManager = new VerticalFieldManager(
VerticalFieldManager.NO_HORIZONTAL_SCROLL |
VerticalFieldManager.VERTICAL_SCROLL) {
protected void paintBackground(Graphics开发者_JS百科 graphics) {
int c = graphics.getColor();
graphics.setColor(Color.WHITESMOKE);
graphics.fillRect(0, 0, bip.getWidth(), bip.getHeight());
graphics.setColor(c);
super.paintBackground(graphics);
}
protected void sublayout(int maxWidth, int maxHeight) {
int width = bip.getWidth();
int height = bip.getHeight();
super.sublayout( width, height);
setExtent( width, height);
}
};
Here bip is a bitmap whose size is 290*220. My screen size is 320*240. So the gridfield dont cover the whole screen but some portion of it.
use GridFieldManager instead of all this its a good option in blackberry
精彩评论