0

这就是我要的:

所需的用户界面

我通过这个创建了顶部的红色布局

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有什么相似之处?是标签文本吗?

4

1 回答 1

1

使用三个布局管理器,一个用于顶部红色部分的标题,使用第二个布局管理器并在其中添加一个列表字段覆盖行的 ListField 绘制方法 ....并将 ToolbarManager 用于下面的选项卡栏

于 2012-06-14T10:29:56.810 回答