2011-08-06 201 views

回答

1

使用

button.setImageResource(resId) 

如:

public boolean onTouch(View v, MotionEvent me) { 
    int action = me.getAction(); 
    if(action == MotionEvent.ACTION_DOWN) { 
     button.setImageResource(R.id.resId1) 
     //other stuff 
     return true; 
    } else if (action == MotionEvent.ACTION_UP) { 
     button.setImageResource(R.id.resId2) 
     //other stuff 
     return true; 

    } 
    return false; 
}