如何在 Android 中创建动态启动画面?

How to create Motion Splash Screen in Android?

我看到一个 link 是设计师为移动应用程序设计的。我想实现this kind of effect or animation我不知道该说什么。

请指导我如何在 android 应用程序启动画面中实现完全相同的效果。

我需要它的 gif 图像并在网络视图中显示吗?

或任何类型的可绘制动画?

任何类型的建议和帮助都将不胜感激。

提前致谢。

您可以使用AnimatorSet

This class plays a set of Animator objects in the specified order. Animations can be set up to play together, in sequence, or after a specified delay.

There are two different approaches to adding animations to a AnimatorSet: either the playTogether() or playSequentially() methods can be called to add a set of animations all at once, or the play(Animator) can be used in conjunction with methods in the Builder class to add animations one by one.

It is possible to set up a AnimatorSet with circular dependencies between its animations. For example, an animation a1 could be set up to start before animation a2, a2 before a3, and a3 before a1. The results of this configuration are undefined, but will typically result in none of the affected animations being played. Because of this (and because circular dependencies do not make logical sense anyway), circular dependencies should be avoided, and the dependency flow of animations should only be in one direction.

您可以在下方 link 查看 demp 案例

  1. Digest Splash for Android

要做的是,在您提供的图像上,所有这些都只是在特定超时时间后从一个图像过渡到另一个图像的单个图像。

您需要为每个过渡帧加载大量图像,然后相应地移动它们。

这有点像在 android 上创建启动动画。 每个图像将代表整个动画的一个帧。

对于动画图像,试试这个(基本上使用 alpha 进行过渡)

ImageView demoImage = (ImageView) findViewById(R.id.DemoImage);
int imagesToShow[] = { R.drawable.image1, R.drawable.image2,R.drawable.image3 };
animate(demoImage, imagesToShow, 0,false);  



private void animate(final ImageView imageView, final int images[], final int imageIndex, final boolean forever) {

//imageView <-- The View which displays the images
//images[] <-- Holds R references to the images to display
//imageIndex <-- index of the first image to show in images[] 
//forever <-- If equals true then after the last image it starts all over again with the first image resulting in an infinite loop. You have been warned.

int fadeInDuration = 500; // Configure time values here
int timeBetween = 3000;
int fadeOutDuration = 1000;

imageView.setVisibility(View.INVISIBLE);    //Visible or invisible by default - this will apply when the animation ends
imageView.setImageResource(images[imageIndex]);

Animation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setInterpolator(new DecelerateInterpolator()); // add this
fadeIn.setDuration(fadeInDuration);

Animation fadeOut = new AlphaAnimation(1, 0);
fadeOut.setInterpolator(new AccelerateInterpolator()); // and this
fadeOut.setStartOffset(fadeInDuration + timeBetween);
fadeOut.setDuration(fadeOutDuration);

AnimationSet animation = new AnimationSet(false); // change to false
animation.addAnimation(fadeIn);
animation.addAnimation(fadeOut);
animation.setRepeatCount(1);
imageView.setAnimation(animation);

animation.setAnimationListener(new AnimationListener() {
    public void onAnimationEnd(Animation animation) {
        if (images.length - 1 > imageIndex) {
            animate(imageView, images, imageIndex + 1,forever); //Calls itself until it gets to the end of the array
        }
        else {
            if (forever == true){
            animate(imageView, images, 0,forever);  //Calls itself to start the animation all over again in a loop if forever = true
            }
        }
    }
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub
    }
    public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub
    }
});

}

对于显示 activity 动画的最后一部分,请参阅此 SO 答案