Reputation: 4487
Intent intent = new Intent(LoginActivity.this, Profile.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
I am using this flags to clear all activity stack after logging in. The problem is, the transition became really ugly since the screen turns to white momentarily. Any workaround to avoid this?
P.S.: Both activities has RED Color as their background. I am wondering where the white color cames from.
Upvotes: 5
Views: 2788
Reputation: 5381
In your styles.xml
file add this line:
<style name="AppTheme" parent="Theme.AppCompat">
<item name="android:windowDisablePreview">true</item>
...
</style>
It will disable preview mode for the new loaded screen (aka white/black screen).
If you want to use a custom background before loading a new screen, consider adding the following line:
<style name="AppTheme" parent="Theme.AppCompat">
<item name="android:windowBackground">@drawable/slash_screen</item>
...
</style>
Upvotes: 2