Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 黑莓中的标准标题栏_Blackberry - Fatal编程技术网

Blackberry 黑莓中的标准标题栏

Blackberry 黑莓中的标准标题栏,blackberry,Blackberry,如何更改的背景色。我尝试过使用StandardTitleBar.setBackgroundBackground b,但它似乎不起作用。你不能用那种方式来做这件事。尝试覆盖主屏幕中的setTitle功能检查此代码 public class CustomScreenTitle extends HorizontalFieldManager { private Bitmap titleHeaderImg= null; public CustomScreenTitle(String ti

如何更改的背景色。我尝试过使用StandardTitleBar.setBackgroundBackground b,但它似乎不起作用。

你不能用那种方式来做这件事。尝试覆盖主屏幕中的setTitle功能检查此代码

public class CustomScreenTitle extends HorizontalFieldManager {
    private Bitmap titleHeaderImg= null;

    public CustomScreenTitle(String title, Resolutions resolutions){

        super(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR | USE_ALL_WIDTH);
        titleHeaderImg = Bitmap.getBitmapResource("header.png");

        Font f = Resolutions.titleFont;
        int headerWidth = f.getAdvance(title);
        Padding p = resolutions.setTitlePadding(headerWidth);

        CustomLabelField titleLabel = new CustomLabelField(title, Field.FIELD_HCENTER, p, Resolutions.titleFont);
        titleLabel.setFontColor(Color.WHITE);
        add(titleLabel);
    }
      public void paint(Graphics graphics)
      {
          graphics.clear();
          if(titleHeaderImg != null)
          graphics.drawBitmap(0, 0, titleHeaderImg.getWidth(), titleHeaderImg.getHeight(), titleHeaderImg, 0, 0);                       
          super.paint(graphics);
      } 
}

试试下面的。。。这对我很有用:

HorizontalFieldManager manager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
manager.setBackground(yourBackground);
manager.add(your field);
setTitle(manager);