Android splash screen spin or swirl
Hi I was curious if anybody knew of a way to make the s开发者_如何学Goplash screen spin/swirl
when app was ran for the first time. The image im wanting to spin/swirl is a png.
For a swirl you would have to create your own animation but for rotate you just animate the ImageView.
RotateAnimation animation = new RotateAnimation(0f, 360f);
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(1000);
ImageView imageView= (ImageView) findViewById(R.id.splash_screen);
imageView.startAnimation(animation);
There are other methods of Animation and RotateAnimation that you can use to customize the animation.
Simple, just create the image which you want to rotate. and just write the following code in you splash screen. *note:-here 2160f is the total degree of rotation and 3000 is the time of rotation....here it is 3 seconds
ImageView image=(ImageView) findViewById(R.id.imageView);
image.animate().rotation(2160f).setDuration(3000);
SAME CODE ON ANDROID KOTLIN
val iv : ImageView = findViewById(R.id.title_pic)
val rotation :RotateAnimation = RotateAnimation(0f,360f)
rotation.repeatCount = Animation.ZORDER_NORMAL // here you can use any Animation effect
rotation.duration = 1000
iv.startAnimation(rotation)
精彩评论