0

垂直滚动后如何保留背景图像?

现在,我让图像适合设备的高度和宽度,但是当我向下滚动时,它会显示白色背景。

这是我的代码

 BitmapField _bitmap ;
 private int phoneWidth = Display.getWidth();
 private int cellHeight = Display.getHeight();

 public MyScreen(){

    super(Manager.USE_ALL_WIDTH | Manager.VERTICAL_SCROLL);

    final Bitmap background = Bitmap.getBitmapResource("black.jpg");
    VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH) {
        public void paint(Graphics g) {
            Bitmap scaled = new Bitmap(phoneWidth, cellHeight);         
            background.scaleInto(scaled, Bitmap.SCALE_TO_FIT);
            g.drawBitmap(0, 0, phoneWidth, cellHeight,
                         scaled, 0, 0);
            super.paint(g);
        }
    };
    add(vfm);
 }

我正在模拟器 Blackberry 9900 中进行测试。

4

0 回答 0