0

如何 在单击位图check_box1 时通过另一个更改位图check_box2check_box1

btmp_on = EncodedImage
            .getEncodedImageResource("btn_check_on.png");

    btmp_off = EncodedImage
            .getEncodedImageResource("btn_check_off.png");
    Bitmap check_box1 = getScaledBitmapImage(btmp_off,30,40);
    Bitmap check_box2 = getScaledBitmapImage(btmp_on,30,40);
4

1 回答 1

0

请参阅下面的链接:

对于自定义列表字段

对于触摸设备,在 fieldChanged 中添加相同的代码到 touchEvent

protected boolean touchEvent(TouchEvent message) 
{
    switch( message.getEvent() ) 
    {          
        case TouchEvent.CLICK:
            clickButton();
            break;

        default: break;
    }
    return super.touchEvent(message);
}
private void clickButton()
{
    Field focussedOne=this.getLeafFieldWithFocus();//Means this is the last field which is not having any otherFields;
    for(int i=0;i<size;i++)
    {
        if(focussedOne==listStyleButtonField[i])
        {
            if(listStyleButtonField[i].getChanged())
                listStyleButtonField[i].changeBitmap(bitmap,false);
            else
                listStyleButtonField[i].changeBitmap(bitmapHover,true);
        }
    }
}
于 2012-06-27T07:59:39.637 回答