Android ImageView Animation

前端 未结 9 1038
忘掉有多难
忘掉有多难 2020-12-04 07:32

I\'ve created a layout with an image view and a web view. The web view is set to have a default visibility of gone. When the activity fires up it displays the image view fir

9条回答
  •  Happy的楠姐
    2020-12-04 08:11

    Use a RotateAnimation, setting the pivot point to the centre of your image.

    RotateAnimation anim = new RotateAnimation(0f, 350f, 15f, 15f);
    anim.setInterpolator(new LinearInterpolator());
    anim.setRepeatCount(Animation.INFINITE);
    anim.setDuration(700);
    
    // Start animating the image
    final ImageView splash = (ImageView) findViewById(R.id.splash);
    splash.startAnimation(anim);
    
    // Later.. stop the animation
    splash.setAnimation(null);
    

提交回复
热议问题