Reputation: 19273
I want to better the user experience of my app.
I have an Activity which takes a time to load, so I am creating like a fake screen before the actual screen is loaded.
The fake screen should look exactly like the new screen so that the change is not visible.
However, Android is making a "flashy" transition between the two activities, which results in a worse experience. This transition sometimes depends on the phone model.
Is there a way to prevent any kind of animation and just display the activity contents without transition or flash (black or white) ?
Upvotes: 4
Views: 3129
Reputation: 575
Try with this in your xml theme:
<item name="android:windowBackground">@color/black</item>
<item name="android:colorBackground">@color/black</item>
Changing the color with the color that you want.
Upvotes: 2
Reputation:
Try something like this, overridePendingTransition(0, 0)
will force device to not use any animation for transition.
Intent intent = new Intent(SplashActivity.this, ChatActivity.class);
startActivity(intent);
overridePendingTransition(0, 0);
Upvotes: 0
Reputation: 888
Create a custom style which disables the animation:
<style name="noAnimation" parent="android:Theme">
<item name="android:windowAnimationStyle">@null</item>
</style>
And set it for your activities in the AndroidManifest.xml
file:
<activity android:name=".YourActivity" android:theme="@style/noAnimation">
</activity>
or set it for your whole application:
<application android:theme="@style/noAnimation">
Upvotes: 3