tags:

views:

21

answers:

3

Hi All,

Need lil help regarding paint method in MainScreen. Using the code above, I was trying to render some lists. It works fine. But it hides all my status bar icons i added using setStatus() method. When I remove the paint method , my buttons in status bar shows up. Also I have tried using setRe g.pushRegion() , but no luck.

Here is sample code :

private void addStatusBar(){
    manager = new HorizontalFieldManager();
    manager.add(new BitmapField(ImageUtility.loadBitMap("ask.jpg")));
    manager.add(new BitmapField(ImageUtility.loadBitMap("experts.jpg")));
    manager.add(new BitmapField(ImageUtility.loadBitMap("search.jpg")));
    manager.add(new BitmapField(ImageUtility.loadBitMap("my_profile.jpg")));
    manager.add(new BitmapField(ImageUtility.loadBitMap("groups.jpg")));
    manager.add(new BitmapField(ImageUtility.loadBitMap("analitics.jpg")));

    setStatus(manager);

}

protected void paint(Graphics graphics) {
    //graphics.pushRegion(new XYRect(0, 0, getPreferredWidth(), getPreferredHeight()));
    Bitmap image = ImageUtility.loadBitMap("header2.jpg");
    graphics.drawBitmap(0, 0, 500, image.getHeight(), image, 0, 0);

    for(int i =0; i < 5; i++ ){
        fieldList.drawListRow(fieldList, graphics, i, 50 + (i*50), 20);         
    }
}
A: 

Have you tried setting the "y" offset for the graphics.drawBitmap() call to the height of the status bar?

Marc Novakowski
A: 

you need to call super.paint Otherwise the status is never painted.

haagmm
A: 
protected void paint(Graphics graphics) {
Bitmap image = ImageUtility.loadBitMap("header2.jpg");
graphics.drawBitmap(0, 0, 500, image.getHeight(), image, 0, 0);
for(int i =0; i < 5; i++ ){
    fieldList.drawListRow(fieldList, graphics, i, 50 + (i*50), 20);         
}     
super.paint(graphics); }
rupesh