このカスタムヘッダーを試してください:
public class TopBar extends HorizontalFieldManager implements FieldChangeListener{
int width;
int height;
Bitmap bgBitmap;
Button btnHome;
Bitmap btnImage;
boolean isHome;
MainScreen screenFromNavigate;
LabelField lblTitle;
public TopBar(String title)
{
super(FIELD_HCENTER);
setLayout(title);
}
public void setLayout(String title)
{
this.width=Display.getWidth();
this.height=50;
this.bgBitmap= Bitmap.getBitmapResource("topbar.png");
this.isHome = isHomeBtn;
btnHome = new ButtonField("Button 1");
btnHome.setMargin(7, 0, 0, 15);
add(btnHome);
btnHome.setChangeListener(this);
lblTitle = new LabelField(title);
add(lblTitle);
lblTitle.setMargin(12, 0, 0,Display.getWidth()/2-160);
}
protected void sublayout(int maxWidth, int maxHeight)
{
maxWidth=width;
maxHeight=height;
super.sublayout(maxWidth, maxHeight);
setExtent(maxWidth, maxHeight);
}
protected void paint(Graphics graphics)
{
graphics.drawBitmap(0, 0, Display.getWidth(),50, bgBitmap, 0, 0);
// graphics.setBackgroundColor(Color.GRAY);
// graphics.clear();
super.paint(graphics);
}
public void fieldChanged(Field field, int context) {
// TODO Auto-generated method stub
}
}
}
これを呼んでください:
TopBar topBar = new TopBar( "Test");
setTitle(topBar);