带有动画的android studio问题-上下文可运行

问题描述

我有以下问题: topAnimation = AnimationUtils.loadAnimation(this,R.anim.top_animation); bottomAnimation = AnimationUtils.loadAnimation(this,R.anim.bottom_animation);

这向我展示了可以在bottomAnimation和topAnimation中运行的上下文

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(splashScreen.this,MainActivity.class));

                // variable
                Animation topAnimation,bottomAnimation;
                ImageView logo;
               TextView welcome,name_app;

                //animation
                topAnimation= AnimationUtils.loadAnimation(this,R.anim.top_animation);
                bottomAnimation=AnimationUtils.loadAnimation(this,R.anim.bottom_animation);

                logo=findViewById(R.id.imageView);
                name_app = findViewById(R.id.app_name);
                welcome = findViewById(R.id.welcom);

                logo.setAnimation(topAnimation);
                name_app.setAnimation(topAnimation);
                welcome.setAnimation(bottomAnimation);
                finish();
            }
        },3000);
    }
[enter image description here][1]


  [1]: https://i.stack.imgur.com/Ia2Bb.png

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)