问题
I am wondering if its at all possible to cancel ALL animation when starting an singleInstance activity, i am already using
@Override
public void onStop() {
super.onStop();
overridePendingTransition(0, 0);
}
@Override
public void onResume() {
super.onResume();
overridePendingTransition(0, 0);
}
for when finish is called and
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
to activate it... but theres still a black screen ( short loading one). trying creating a costume Theme and didnt cancel it.
i kinda gave up hope... I know fragments will solve it. is there any way without?
回答1:
Have you tried calling overridePendingTransition
after calling startActivity(...)
You can also disable animations via themes
Developer should create a style,
<style name="noAnimTheme" parent="android:Theme">
<item name="android:windowAnimationStyle">@null</item>
</style>
then in manifest set it as theme for activity or whole application.
<activity android:name=".ui.ArticlesActivity" android:theme="@style/noAnimTheme">
</activity>
You can also specify a style to specify custom entry and exit animations, so you can make it do what you like as well http://developer.android.com/reference/android/R.attr.html#windowEnterAnimation
来源:https://stackoverflow.com/questions/18989331/cancel-all-animation-on-singleinstance