Cancel ALL Animation on SingleInstance

拜拜、爱过 提交于 2019-12-23 16:41:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!