2012-06-05 70 views
0

這就是我想要的:如何實現這個UI?

Desired UI

我已經通過這個

public class Custom_TopField extends VerticalFieldManager { 
private static final int FIELD_HEIGHT = 70; 

private String _text; 

Custom_TopField(int color, String text) { 
    super(Manager.NO_VERTICAL_SCROLL); 
    _text = text; 

    Background background = BackgroundFactory.createSolidBackground(color); 
    setBackground(background); 
} 

protected void sublayout(int width, int height) { 
    width = Math.min(width, getPreferredWidth()); 
    height = Math.min(height, getPreferredHeight()); 
    setExtent(width, height); 
} 

public int getPreferredHeight() { 
    return FIELD_HEIGHT; 
} 

public int getPreferredWidth() { 
    return Display.getWidth(); 
} 

public void paint(Graphics graphics) { 
    int rectHeight = getPreferredHeight(); 
    int rectWidth = getPreferredWidth(); 

    Font font = Font.getDefault().derive(Font.BOLD, 35); 
    graphics.setFont(font); 
    graphics.setColor(Color.WHITE); 
    graphics.drawRect(0, 0, rectWidth, rectHeight); 
    graphics.drawText(_text, rectWidth * 4/9, 10); 
    super.paint(graphics); 
} 

}

什麼是黑莓類似的TextView創建頂紅色的佈局?它是labeltext嗎?

+0

等價物將是一個'LabelField'。 –

回答

1

使用threee佈局管理器,一個用於頂部紅色部分的標題,使用第二個佈局管理器並在其中添加一個列表字段,替代列的ListField繪製方法....並使用ToolbarManager作爲以下標籤欄