Android Studio Fading Splash Into Main
I currently am working on an android app. Just started and I was able to implement my splash screen. However, I don't like the transition between that and the main activity. I want
Solution 1:
You could use two .xml files to fade in a new Activity and fade out the current Activity.
fade_in.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="500" />
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500" />
Use it in code like that: (Inside your Activity)
Intent intent = new Intent();
intent.setClass(sPlashScreen, MainActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
The above code will fade out the currently active Activity and fade in the newly started Activity.
Post a Comment for "Android Studio Fading Splash Into Main"