by code, you can do something like this:
Animation anim = AnimationUtils.loadAnimation(this, R.anim./*YOUR ANIMATION*/);
anim.setAnimationListener(new Animation.AnimationListener(){
@Override
public void onAnimationStart(Animation arg0) {
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationEnd(Animation arg0) {
if(ButtonName.isChecked()){
ButtonName.setImageResource(R.drawable.ImageChecked);
}else{
ButtonName.setImageResource(R.drawable.ImageUnchecked);
}
}
});
ButtonName.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
ButtonName.startAnimation(anim);
}
});
1
solved Android Radio Button Animation