0

In my one activity page, there are many item. One of items, use startActivity() go to an android system settings activity, And its activity transition animation is slide_out_left.

The other items use startActivity() go to my own activity. and activity transition animation is fade_out(defined in my style.xml).

I think that is a reason, but I don't know why? Why my style.xml changed all activity transition animation except one. or its there something I didn't notice?

And how can I consistent all activity transition animation in XML file?

(I know overridePendingTransition() can change the animation, but I want to modify in .xml file, not in java code, to stay my java code easy readable in the future.)

steve Lee
  • 11
  • 3

1 Answers1

0

Please have a look at this answer and see whether it solves your issue or not: Start Activity with an animation

In short:

<style name="AppTheme">
    <item name="android:windowAnimationStyle">@style/MyAnimation</item>
</style>

<style name="MyAnimation" parent="android:style/Animation.Activity">
    <item name="android:activityOpenEnterAnimation">@anim/open_enter</item>
    <item name="android:activityOpenExitAnimation">@anim/open_exit</item>
    <item name="android:activityCloseEnterAnimation">@anim/close_enter</item>
    <item name="android:activityCloseExitAnimation">@anim/close_exit</item>
</style>

If you think this answers your question, please go to that original link that put in the answer and give the original author credit :)

Community
  • 1
  • 1
Armin
  • 1,807
  • 20
  • 21
  • thank you, but it doesn't work. Actually, this answer is what I did in my style.xml. – steve Lee Sep 23 '15 at 14:50
  • So, if I understand correctly, you did apply the MyAnimation the same as the code above and you also applied the AppTheme to the application theme in the manifest, correct? Please let us know what exactly does work and what does not work, in case a step is missing. Thanks. – Armin Sep 23 '15 at 15:30
  • You are right, I should express clearly. thanks again. I found that when I startactivity() to 'system settings', the transition animation is decided by the theme of 'system settings'. and it will call: @anim/task_open_enter So, I think that it's hard to change from my app's theme. – steve Lee Sep 26 '15 at 05:57