0

私のCustom_Fieldクラスはそのようなものです:

public class Custom_BottomField extends Field {

private Bitmap _backgroundBitmap = Bitmap
        .getBitmapResource("footer_bar.png");

private Bitmap finance = Bitmap.getBitmapResource("icon_economy.png"),
        special = Bitmap.getBitmapResource("icon_title.png"),
        forum = Bitmap.getBitmapResource("icon_forum.png"),
        discussion = Bitmap.getBitmapResource("icon_discussion.png"),
        other = Bitmap.getBitmapResource("icon_other.png");

private BitmapField financebtn, specialbtn, forumbtn, discussionbtn,
        otherbtn;

Custom_BottomField() {
    Background background = BackgroundFactory
            .createBitmapBackground(_backgroundBitmap);
    setBackground(background);
}

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

public int getPreferredHeight() {
    return 70;
}

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

protected void paint(Graphics graphics) {
    int rectHeight = getPreferredHeight();
    int rectWidth = getPreferredWidth();
    graphics.drawRect(0, 0, rectWidth, rectHeight);
    graphics.drawBitmap(getGap(), 5, finance.getWidth(),
            finance.getHeight(), finance, 0, 0);
    graphics.drawBitmap(rectWidth / 5 + getGap(), 5, special.getWidth(),
            special.getHeight(), special, 0, 0);
    graphics.drawBitmap(rectWidth * 2 / 5 + getGap(), 5, forum.getWidth(),
            forum.getHeight(), forum, 0, 0);
    graphics.drawBitmap(rectWidth * 3 / 5 + getGap(), 5,
            discussion.getWidth(), discussion.getHeight(), discussion, 0, 0);
    graphics.drawBitmap(rectWidth * 4 / 5 + getGap(), 5, other.getWidth(),
            other.getHeight(), other, 0, 0);
}

private int getGap() {
    return ((getPreferredWidth() / 5) - finance.getWidth()) / 2;
}

private void Button() {
    financebtn = new BitmapField(finance, BitmapField.FOCUSABLE) {
        protected boolean navigationClick(int status, int time) {
            MyApp.getUiApplication().pushScreen(new Main_ParticulatCategoryAllNews());
            return true;
        }
    };
}
}

上記のクラスは、この画像で強調表示されています

Fieldボタンをクリックしてクラスに移動したいので、クラスに BitmapField を追加できませんMain_ParticulatCategoryAllNews

4

1 に答える 1

0

extendsHorizontalFieldManagerと using で解決add()

于 2012-06-18T09:21:26.753 に答える