如何更改应用程序的启动动画?

时间:2018-01-11 15:38:45

标签: java android android-animation launching-application programmatically

有没有办法以编程方式更改应用程序启动动画? 每当我启动一个应用程序时,它的动画就像它来自屏幕底部,但我希望它来自屏幕顶部。

感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

你可以简单地使用AlphaAnimation,并在 onCreate()方法中将它应用到Activity的布局中:

super.onCreate(savedInstace);
this.setContentView(R.layout.main);
RelativeLayout layout = findViewById(R.id.idLayout);
AlphaAnimation animation = new AlphaAnimation(0.0f , 1.0f ) ;
animation.setFillAfter(true);
animation.setDuration(1200);
//apply the animation ( fade In  or whatever you want) to your LAyout
layout.startAnimation(animation);

答案 1 :(得分:0)

你可以试试这个

动画文件夹中的

top_down.xml

file://"$PWD"/fullSystemBackup/

动画文件夹中的

down_top.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
 <translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="5000"/>
 <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="5000" />
</set>

并适用于此。

 <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
     <translate android:fromYDelta="0" android:toYDelta="100%p" android:duration="5000" />
     <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="5000" />
 </set>