0

我已经搜索但没有找到任何解决方案,我有但它会产生问题。当我插入它时,它会说非法参数并且不会启动。

Bitmap bitmap = Bitmap.getBitmapResource("Background.png");

 this.getMainManager().setBackground(

             BackgroundFactory.createBitmapBackground(bitmap)
         );

它不起作用。

感谢您的帮助!它的工作。只是我的路径的拼写错误

4

1 回答 1

1

tyy这个-

final Bitmap top = Bitmap.getBitmapResource("your background image.png");
final VerticalFieldManager top_ = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){

        public void paint(Graphics graphics) {
            graphics.drawBitmap(0, 0, top.getWidth(),
                    top.getHeight(), top, 0, 0);
            super.paint(graphics);
        }

    };

现在您将所有字段添加到此顶部_。然后将 top_ 添加到您的屏幕。如果没有字段,则不会显示背景图像。所以不要忘记添加一些字段。

于 2012-10-10T10:44:54.790 回答