在blackberry java中创建自定义状态栏

时间:2015-02-06 07:35:29

标签: java blackberry

enter image description here

这是我到目前为止尝试的代码我需要获取视图如上图所示。但在我的代码中所有图像都分组在左侧,如果我添加背景颜色或backgroundimage图标什么都不会看到期望backgroundcolor什么我做错了请帮助我,我是bb的新手

 HorizontalFieldManager statusbar = new HorizontalFieldManager( );
/*  {
    public void paint(Graphics g){
        g.setBackgroundColor(0x000000);
        g.clear();
    }
    };*/
    VerticalFieldManager profvfm = new VerticalFieldManager();  

Bitmap msg3 = Bitmap.getBitmapResource("emailicon.png");
BitmapField bitmapField2 = new BitmapField(msg3);
profvfm.add(bitmapField2);
LabelField prolbl = new LabelField("My Profile", LabelField.FOCUSABLE)
{
    protected void paintBackground(net.rim.device.api.ui.Graphics g)
    {
        g.clear();
        g.getColor();
        g.setColor(Color.BLACK);
       // g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
       // g.setColor(Color.BLUE);               
    }
};  

FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font = fontFamily[1].getFont(Font.BOLD, 21);
prolbl.setFont(font);
profvfm.add(prolbl);
statusbar.add(profvfm);
VerticalFieldManager emlvfm = new VerticalFieldManager();   
Bitmap msg5 = Bitmap.getBitmapResource("emailicon.png");
BitmapField bitmapField5 = new BitmapField(msg5);
emlvfm.add(bitmapField5);
LabelField emllbl = new LabelField("Inbox", LabelField.FOCUSABLE)
{
    protected void paintBackground(net.rim.device.api.ui.Graphics g)
    {
        g.clear();
        g.getColor();
        g.setColor(Color.BLACK);
       // g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
       // g.setColor(Color.BLUE);               
    }
};  

// FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font1 = fontFamily[1].getFont(Font.BOLD, 28);
emllbl.setFont(font1);
emlvfm.add(emllbl); 
statusbar.add(emlvfm);

VerticalFieldManager socialvfm = new VerticalFieldManager();    
Bitmap msg4 = Bitmap.getBitmapResource("emailicon.png");
BitmapField bitmapField3 = new BitmapField(msg4);
socialvfm.add(bitmapField3);
LabelField scllbl = new LabelField("Social", LabelField.FOCUSABLE)
{
protected void paintBackground(net.rim.device.api.ui.Graphics g)
{
    g.clear();
    g.getColor();
    g.setColor(Color.BLACK);
  // g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
  // g.setColor(Color.BLUE);               
}
};  

// FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font2 = fontFamily[1].getFont(Font.BOLD, 28);
scllbl.setFont(font2);
socialvfm.add(scllbl); 
 statusbar.add(socialvfm);
setStatus(statusbar);

以及如何设置标签的字体以便我可以像在图像中一样看

0 个答案:

没有答案