The difference between Android transition animations windowanimation and activityanimation

Source: Internet
Author: User

The difference between Android transition animations Windowanimation and activityanimation

Obviously, window and activity itself know differently from names, but the difference between Windowanimation and activityanimation in project development must be understood.

1.windowanimation includes   windowenteranimation   and   windowexitanimation  ;activityanimation contains   android:activityopenenteranimation ,   Android:activityopenexitanimation  ,  android:activitycloseenteranimation  and   android:activitycloseexitanimation

2. The Windowanimation control over the project is greater than the control of the activity, that is, if both windowanimation and Activityanimation are set during the activity transition, Possible (because of this very much) will only execute windowanimation

3. The definition of windowanimation is simple, only need to inherit the animation style in the Style.xml file

<style name= "Animation" parent= "@android: Style/animation" > <!--form into animation--<item name= "Androi D:windowenteranimation "> @anim/slide_left_enter</item> <!--form Exit Animation--<item name=" Android:wi Ndowexitanimation "> @anim/slide_right_exit</item> </style>


for activity, you need to inherit the animation activity Style

<style name= "Feelyouwindowanimtheme" parent= "@android: style/animation.activity" > <item name= "android: Activityopenenteranimation "> @android:anim/slide_in_left</item> <item name=" Android: Activityopenexitanimation "> @android:anim/slide_out_right</item> <item name=" Android: Activitycloseenteranimation "> @anim/push_right_in</item> <item name=" Android: Activitycloseexitanimation "> @anim/push_left_out</item></style>

When we start A2 from A1, A1 disappears from the screen, the animation is called android:activityopenexitanimation when we start A1 from A2, A2 appears on the screen, this animation is called Android:activityopenent Eranimation when we exit from A2 back to A1, A2 disappears from the screen, this is called android:activitycloseexitanimation when we exit from A2 back to A1, A1 appears on the screen, this is called android:act Ivitycloseenteranimation

From the definition of the above 2 animation, it is obvious that activityanimation is more complex, but the transition effect of this complex is very good, can control the animation of 2 activity at the same time, Unlike Windowanimation, you can only control the form animation of the next activity.

5. In development, form animations can also use Activity. Overridependingtransition can be set or defined in a theme, but activity can only be used in themes

<application android:name= "Test.view.weitop.BaseApplication" android:allowbackup= "false" Android:hardwareaccel Erated= "false" android:icon= "@drawable/app_logo" android:label= "@string/app_name" android:largeheap= "true" and Roid:theme= "@style/theme.app" > </application>


6. For the comparison of the pursuit of aesthetic aesthetics of animation, the use of activityanimation is much better, so for general development use windowanimation can, but for the pursuit of user experience, then directly use Activity Animation Bar


The difference between Android transition animations windowanimation and activityanimation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.