Android : Android - Change the background of transition

on Saturday, July 5, 2014


I'm trying to make a simple fade to white transition between my activities, but I've encountered a problem, in that the background between activities are always black.


Here's an example of what I'm doing at the moment.



new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent();
intent.setClass(SplashActivity.this, MainActivity.class);
SplashActivity.this.startActivity(intent);
SplashActivity.this.finish();
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
}
}, 3000);


fadein.xml



<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="1000" />


fadeout.xml



<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="top" android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="1000" />


So obviously I need to do something different and any help would be much appreciated!


Edit: Just to make it clear, this is the background in between activities, not my background in the activity. I don't think TransitionDrawable will do me much good, but I might be mistaken?


0 comments:

Post a Comment