Use theme to customize the activity to exit the animation

Source: Internet
Author: User

Do you think the default animation of an activity is too fast or ugly ..
I used activity. overridependingtransition to customize the animation for entering the activity, but I found that the animation for exiting cannot be defined. The results show the powerful theme and style, and you need to study it later.

Specifically, this is the case:
In androidmanifest, you can define the theme attribute for the application and activity labels. If an attribute is defined for the application, it will affect all the activities. Of course, you can overwrite it in the activity.

<Application Android: theme = "@ style/themeactivity">

Then in values/themes. xml

<Style name = "themeactivity" mce_bogus = "1">
<Item name = "Android: windowanimationstyle"> @ style/animationactivity </item>
<Item name = "Android: windownotitle"> true </item>
</Style>

In values/styles. xml

<Style name = "animationactivity" parent = "@ Android: style/animation. Activity" mce_bogus = "1">
<Item name = "Android: activityopenenteranimation"> @ anim/push_left_in </item>
<Item name = "Android: activityopenexitanimation"> @ anim/push_left_out </item>
<Item name = "Android: activitycloseenteranimation"> @ anim/push_right_in </item>
<Item name = "Android: activitycloseexitanimation"> @ anim/push_right_out </item>
</Style>

In this way, you can define the animation in anim. This is the same as the normal animation. If you do not know it, see

Http://developer.android.com/guide/topics/graphics/view-animation.html.

In addition to defining the animation of an activity, you can also define the animation of a task and window. For details, see

Http://developer.android.com/reference/android/R.styleable.html#WindowAnimation

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.