繁体   English   中英

如何使用动画启动应用程序主要活动

[英]How to start Application main activity with Animation

当调用onCreate()方法时,如何通过翻译动画在活动中显示我的对象?

我在onCreate()的setContentView()之后调用了此方法,但是不起作用! 请帮助我,请不要给我负面的观点!

 public void startAnimation(){
    LinearLayout header=(LinearLayout) findViewById(R.id.layout_main_header);
    LinearLayout onOff=(LinearLayout) findViewById(R.id.layout_main_onoff);
    LinearLayout social=(LinearLayout) findViewById(R.id.social_layer);
    LinearLayout netwo=(LinearLayout) findViewById(R.id.network_layer);
    Animation in_1=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.in_1);
    Animation in_2=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.in_2);
    Animation in_3=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.in_3);
    Animation in_4=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.in_4);
    header.startAnimation(in_1);
    onOff.startAnimation(in_2);
    social.startAnimation(in_3);
    netwo.startAnimation(in_4);
}

在您的代码中没什么错,请向您显示动画的xml和向您的活动显示xml

注意:将您的代码从方法移动到onCreate()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM