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