开发者

Blackberry gridfield issue

开发者 https://www.devze.com 2023-03-28 20:56 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消