Skip to content Skip to sidebar Skip to footer

Android Animate Background Image

I have one Relative Layout and i have set it's background as drawable, which is a selector. There are total tow background to this Relative Layout and one is in state as selecte

Solution 1:

Please use the following line it will solve your problem.

checkBox1.setOnCheckedChangeListener(newCompoundButton.OnCheckedChangeListener() {

               @OverridepublicvoidonCheckedChanged(CompoundButton buttonView,boolean isChecked) {


                    imageView1.setBackgroundResource(R.drawable.checkbox_normal);
                    AnimationhyperspaceJump= AnimationUtils.loadAnimation(Test1Activity.this, R.anim.animation_big_to_small_rotate); 
                    imageView1.startAnimation(hyperspaceJump); 
                    imageView1.setVisibility(View.VISIBLE);


               }
            });

instead of animation_big_to_small_rotate use the xml file which you have for animation. and you can change the images as your wish.

Post a Comment for "Android Animate Background Image"