2012-06-26 27 views
0

我怎麼能由另一個check_box2上更改位圖check_box1單擊該位圖check_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); 
+0

根據你告訴我,我可以理解你正在使用擴展字段的CustomBitmapField。我建議你讓CustomBitmapField擴展BitmapField並覆蓋public void setBitmap(Bitmap _bmp)方法。和你的位圖setBitmap(Bitmap bmp)來改變圖像 – ayachama

回答

0

看到這個鏈接如下:

For CustomListField

和觸摸設備添加field中的相同代碼更改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); 
     } 
    } 
}