Blackberry 如何更改HorizontalFieldManager的背景

Blackberry 如何更改HorizontalFieldManager的背景,blackberry,java-me,horizontalfieldmanager,Blackberry,Java Me,Horizontalfieldmanager,我想设置HorizontalFieldManager的背景。 我一直在搜索的示例代码是使用渐变设置主屏幕背景的背景 //create gradient linear for background this.getMainManager().setBackground(BackgroundFactory.createLinearGradientBackground(0x0099CCFF, 0x0099CCFF,0x00336699,0x0

我想设置HorizontalFieldManager的背景。 我一直在搜索的示例代码是使用渐变设置主屏幕背景的背景

 //create gradient linear for background
 this.getMainManager().setBackground(BackgroundFactory.createLinearGradientBackground(0x0099CCFF,
                            0x0099CCFF,0x00336699,0x00336699)
                        );
然后我尝试使用相同的模式将背景设置为HorizontalFieldManager,因为它有这个方法。但这行不通。这是密码

            HorizontalFieldManager hManager = new HorizontalFieldManager();

    Bitmap bitmapImage = null;

    bitmapImage = Bitmap.getBitmapResource("img/home.png");
    tabHome = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
            | BitmapField.HIGHLIGHT_FOCUS);

    bitmapImage = Bitmap.getBitmapResource("img/in.png");
    tabCheckInOut = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
            | BitmapField.HIGHLIGHT_FOCUS);

    bitmapImage = Bitmap.getBitmapResource("img/barcode.png");
    tabBarcode = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
            | BitmapField.HIGHLIGHT_FOCUS);

    bitmapImage = Bitmap.getBitmapResource("img/options.png");
    tabOptions = new BitmapField(bitmapImage, BitmapField.FOCUSABLE
            | BitmapField.HIGHLIGHT_FOCUS);

    tabHome.setFocusListener(this);
    tabCheckInOut.setFocusListener(this);
    tabBarcode.setFocusListener(this);
    tabOptions.setFocusListener(this);

    Background topBack = BackgroundFactory.createSolidBackground(0x00606A85);
    hManager.setBackground(topBack);

    hManager.add(tabHome);
    hManager.add(tabCheckInOut);
    hManager.add(tabBarcode);
    hManager.add(tabOptions);

    add(hManager);
我使用HorizontalFieldManager并添加4个位图字段,然后使用BackgroundFactory创建solidBackground,并将其设置为manager 但当我运行它时,背景色不适用。梯度的例子效果很好。有什么我遗漏的吗?请帮帮我


在做了一些deep web搜索之后,谢谢你。这是答案,伙计们

HorizontalFieldManager manager = new HorizontalFieldManager()
{
    public void paint(Graphics graphics)
    {
        graphics.setBackgroundColor(0x000000FF);//blue
        graphics.clear();
        super.paint(graphics);
    }
};
更新: 您只能使用网页颜色 例如0x006699FF应该可以工作 但0x00606A85不起作用。 如果您想要特定的颜色,我建议您使用位图

更新: 另一个解决方案

 HorizontalFieldManager manager = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
 manager.setBackground(BackgroundFactory.BackgroundFactory
            .createSolidBackground(0x00cccccc));

在做了一些深度网络搜索之后。这是答案,伙计们

HorizontalFieldManager manager = new HorizontalFieldManager()
{
    public void paint(Graphics graphics)
    {
        graphics.setBackgroundColor(0x000000FF);//blue
        graphics.clear();
        super.paint(graphics);
    }
};
更新: 您只能使用网页颜色 例如0x006699FF应该可以工作 但0x00606A85不起作用。 如果您想要特定的颜色,我建议您使用位图

更新: 另一个解决方案

 HorizontalFieldManager manager = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
 manager.setBackground(BackgroundFactory.BackgroundFactory
            .createSolidBackground(0x00cccccc));

你可以发布你的解决方案并接受它。实际上,我认为你应该发布你的解决方案作为答案并接受它。你能检查一下下面的代码是否对你有帮助吗,我不确定。。。hfmthree=new HorizontalFieldManager(){受保护的void paint(图形){Graphics.setColor(Color.WHITE);super.paint(图形);};你可以发布你的解决方案并接受它。实际上,我认为你应该发布你的解决方案作为答案并接受它。你能检查一下下面的代码是否对你有帮助吗,我不确定。。。hfmthree=new HorizontalFieldManager(){受保护的void paint(图形){Graphics.setColor(Color.WHITE);super.paint(图形);};我在构造函数中设置了USE\u ALL\u宽度。HorizontalFieldManager=新的HorizontalFieldManager(美国所有宽度)。。。etcI在构造函数中设置“全部使用”宽度。HorizontalFieldManager=新的HorizontalFieldManager(美国所有宽度)。。。等