5

这是我的屏幕:

final class GeneralExpenseViewScreen extends MainScreen {
    public GeneralExpenseViewScreen() {
        super();
        LabelField title = new LabelField("TeamMate TEC | Expenses",
                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);

        Background bg = BackgroundFactory.createSolidBackground(0xBDBDDB);
        setBackground(bg);

        HorizontalFieldManager headerAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager filterAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager expenseListAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager totalAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager addNewAreaManager = new HorizontalFieldManager();

        add(headerAreaManager);
        add(filterAreaManager);
        add(expenseListAreaManager);
        add(totalAreaManager);
        add(addNewAreaManager);

        /**Begin form layouts**/

        Bitmap headerImage = Bitmap.getBitmapResource("sergioheader.png");
        BitmapField header = new BitmapField(headerImage);
        headerAreaManager.add(header);

    }

    public boolean onClose() {
        Dialog.alert("AH!");
        System.exit(0);
        return true;
    }
}

请注意,我将 setBackground 直接调用到班级,但它并没有像我认为的那样工作。

如何为我的申请表设置背景颜色?

谢谢。

4

2 回答 2

6

我已经成功使用了这段代码:

protected void paint(Graphics graphics) {
    graphics.setBackgroundColor(0xBDBDDB);
    graphics.clear();
    super.paint(graphics);
}
于 2010-09-08T16:00:34.260 回答
5

根据您正在开发的版本,您可以使用以下

getMainManager().setBackground(BackgroundFactory.createSolidBackground(Color.BLACK));

设置屏幕管理器的背景颜色。

于 2010-09-17T09:51:01.973 回答