VFM的黑莓自定义背景与listfield滚动?

时间:2009-07-10 19:55:06

标签: user-interface blackberry

我想“修复”背景,而只有ListFields滚动。

当前问题:

alt text

向下滚动(周围的框应与列表一起移动)

alt text

VerticalFieldManager的对应代码

VerticalFieldManager _bottom_box = new VerticalFieldManager(Field.FIELD_HCENTER | Field.FIELD_VCENTER | VerticalFieldManager.VERTICAL_SCROLL | Field.USE_ALL_HEIGHT)
        {
            protected void sublayout(int maxWidth, int maxHeight)
            {
                super.sublayout(maxWidth, maxHeight);
                setExtent(maxWidth - 6, maxHeight - 3);
            }
            protected void paint(Graphics graphics)
            {
                graphics.clear();
                graphics.setColor(Color.WHITE);
                graphics.fillRect(0, 0, (this.getWidth()), (this.getHeight()));
                graphics.setColor(color_computacenter_light_blue);
                graphics.drawRect(0, 0, (this.getWidth()), (this.getHeight()));
                super.paint(graphics);
            }
        };

任何想法,如何解决这个问题?感谢

1 个答案:

答案 0 :(得分:2)

如果没有关于该屏幕结构的更多信息,有点难以知道,但根本原因与屏幕上的可见高度(由getHeight()给出)和虚拟高度之间的差异有关。您正在使用该绘制方法绘制到虚拟视口,因此我认为此调整应该可以解决问题:

                    protected void paint(Graphics graphics)
                    {
                            graphics.clear();
                            graphics.setColor(Color.WHITE);
                            graphics.fillRect(0, graphics.getClippingRect().y, (this.getWidth()), (this.getHeight()));
                            graphics.setColor(color_computacenter_light_blue);
                            graphics.drawRect(0, graphics.getClippingRect().y, (this.getWidth()), (this.getHeight()));
                            super.paint(graphics);
                    }