Abhishek
Abhishek

Reputation: 17

How to Change the launch animation of an Application?

Is there any way to change the Application launching animation programmatically ? whenever I am launching a application its animating like its coming from the bottom of the screen but I want it to come from the Top of the screen.

Any help is appreciated.

Upvotes: 1

Views: 4641

Answers (2)

vikas kumar
vikas kumar

Reputation: 11028

you can try this

top_down.xml in anim folder

<?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>

and

down_top.xml in anim folder

 <?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>

and apply to this.

Intent intent = new Intent(this, SomeActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.top_down, R.anim.down_top);

Upvotes: 0

Shubhamhackz
Shubhamhackz

Reputation: 8003

You can simply use the AlphaAnimation , and apply it to the layout of your Activity like this , in the onCreate() method :

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);

Upvotes: 2

Related Questions