0

这是我的课,很简单:

public class SelectYesNoArea extends Manager {

    BitmapField yes;
    BitmapField no;
    DateField date;
    Calendar cal;

    public SelectYesNoArea(long style){
        super(style);           

        Bitmap bgPic = Bitmap.getBitmapResource("divBackgrounds.png");
        Background bg = BackgroundFactory.createBitmapBackground(bgPic);
        setBackground(bg);

        cal = Calendar.getInstance();               
        date = new DateField("",cal.getTime().getTime(), DateFormat.DATE_SHORT);
        add(date);

        Bitmap bitYes = Bitmap.getBitmapResource("yes.png");
        yes = new BitmapField(bitYes);
        add(yes);

        Bitmap bitNo = Bitmap.getBitmapResource("no.png");
        no = new BitmapField(bitNo);
        add(no);
    }   
}

我只想在用户点击位图字段时进行处理。我怎样才能做到这一点?

4

2 回答 2

1

使用匿名类:

yes = new BitmapField(bitYes) {
    trackwheelClick(int status, int time) {
        Do whatever you want here !
    }
}
于 2010-09-22T17:10:19.897 回答
0

Field.FOCUSABLE在创建 BitmapField 时尝试使用该样式。

于 2010-09-22T16:39:58.397 回答