关于改变背景

时间:2015-05-14 17:31:53

标签: android animation background

我放入应用程序的动画有一个圆圈。当我点击圆圈时,我希望背景发生变化。它实际上确实如此,但是当背景发生变化时,它会冻结一秒钟。我该如何解决这个问题?

public class Main extends Activity implements AnimationListener {

   ImageView imageview, imageview2;
   Button rotatescale, countDown;

   // Animasyon
   Animation Animasyonumuz, Animasyonumuz2;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

          imageview = (ImageView) findViewById(R.id.imageView1);
          imageview2 = (ImageView) findViewById(R.id.imageView2);
          rotatescale = (Button) findViewById(R.id.mainb);
          countDown = (Button) findViewById(R.id.countdown);
          CountDownTimer countDownExample = new CountDownExample(30000, 1000);
          countDownExample.start();



          // Animasyonu yükleme
    Animasyonumuz = AnimationUtils.loadAnimation(getApplicationContext(),
                       R.anim.animasyonkadran1);

          // Animasyon listener ı kurma
    Animasyonumuz.setAnimationListener(this);

    Animasyonumuz2 = AnimationUtils.loadAnimation(getApplicationContext(),
            R.anim.animasyonimlec1);


    Animasyonumuz2.setAnimationListener(this);

          // butona dokulduğunda yapılacaklar
    imageview.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
                       // animasyonu baÅŸlatma
                       imageview.startAnimation(Animasyonumuz);
                       imageview2.startAnimation(Animasyonumuz2);
                       imageview.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub


                            imageview.setImageResource(R.drawable.dairebiryesil);
                            imageview.setOnClickListener(new OnClickListener() {

                                @Override
                                public void onClick(View v) {
                                    // TODO Auto-generated method stub
                                    imageview.setImageResource(R.drawable.daireikiyesil);
                                    imageview.setOnClickListener(new OnClickListener() {

                                        @Override
                                        public void onClick(View v) {
                                            // TODO Auto-generated method stub
                                            imageview.setImageResource(R.drawable.daireucyesil);
                                            imageview.setOnClickListener(new OnClickListener() {

                                                @Override
                                                public void onClick(View v) {
                                                    // TODO Auto-generated method stub
                                                    imageview.setImageResource(R.drawable.dairedortyesil);
                                                }
                                            });
                                        }
                                    });
                                }
                            });
                        }
                    });
                 }
          });



   }

0 个答案:

没有答案