Android add activity to exit and enter the animation

Source: Internet
Author: User

Referenced in manifest file

        <activity            android:name= "com.example.MainActivity"            android:configchanges= "Orientation|keyboardhidden "            android:screenorientation=" Portrait "            android:theme=" @style/center_zoom_notitle_fullscreen "/>        <activity

In the Style.xml:

    <style name= "Center_zoom_notitle_fullscreen" parent= "@android: Style/theme" >        <item name= "Android: Windownotitle ">true</item>        <item name=" android:windowistranslucent ">true</item>        <item name= "Android:windowanimationstyle" > @style/center_zoom</item>    </style>

    <style name= "Center_zoom" parent= "@android: style/animation.activity" >        <item name= "Android: Activityopenenteranimation "> @anim/center_to_big_in</item>        <item name=" Android: Activitycloseexitanimation "> @anim/center_to_small_out</item>    </style>

Create center_to_big_in.xml under the Anima directory:

<?xml version= "1.0" encoding= "Utf-8"? ><scale xmlns:android= "http://    Schemas.android.com/apk/res/android "android:duration=" "android:fromxscale=" 0.0 "android:fromyscale=" 0.0 " Android:interpolator= "@android: Anim/decelerate_interpolator" android:pivotx= "50%" android:pivoty= "50%" Android:re peatcount= "0" android:startoffset= "0" android:toxscale= "1.0" android:toyscale= "1.0"/><!--android:repeatmod e= "Reverse" interpolator specifies an animation insert, a common acceleration reducer accelerate_decelerate_interpolator, accelerating the insertion accelerate_interpolator, decelerate the insertion device decelerate_interpolator. Fromxscale,fromyscale, the scale of X, y before the start of the animation, 0.0 is not displayed, 1.0 is the normal size Toxscale,toyscale, the animation finally scales the multiple, 1.0 is the normal size, Greater than 1.0 magnification Pivotx,pivoty animation start position, relative to the percentage of the screen, two are 50% means that the animation starts from the middle of the screen startoffset, animation multiple execution interval time, if only once, the execution will pause the time, unit milliseconds duration , an animation effect consumes time, in milliseconds, the smaller the value the faster the animation repeatcount, the animation repeats the count, the animation will execute the value + 1 times repeatmode, the animation repeats the pattern, the reverse is reversed, and when the first even execution, the animation will be in the opposite direction. Restart for re-execution, direction invariant--> 

  Create Center_to_small_out.xml in the Anima directory:

<?xml version= "1.0" encoding= "Utf-8"? ><scale xmlns:android= "Http://schemas.android.com/apk/res/android"    android:duration= "android:fromxscale="    1.0 "    android:fromyscale=" 1.0 "    Android:interpolator = "@android: Anim/decelerate_interpolator"    android:pivotx= "50%"    android:pivoty= "50%"    android: repeatcount= "0"    android:startoffset= "0"    android:toxscale= "0"    android:toyscale= "0"/><!-- Android:repeatmode= "Reverse" interpolator specify animation insert, common with acceleration reducer accelerate_decelerate_interpolator, Accelerator plug Accelerate_ Interpolator, decelerate the decelerate_interpolator of the insertion device. Fromxscale,fromyscale, the scale of X, y before the start of the animation, 0.0 is not displayed, 1.0 is the normal size Toxscale,toyscale, the animation finally scales the multiple, 1.0 is the normal size, Greater than 1.0 magnification Pivotx,pivoty animation start position, relative to the percentage of the screen, two are 50% means that the animation starts from the middle of the screen startoffset, animation multiple execution interval time, if only once, the execution will pause the time, unit milliseconds duration , an animation effect consumes time, in milliseconds, the smaller the value the faster the animation repeatcount, the animation repeats the count, the animation will execute the value + 1 times repeatmode, the animation repeats the pattern, the reverse is reversed, and when the first even execution, the animation will be in the opposite direction. Restart for re-execution, no change in direction--

Animate exited and entered in Android

Related Article

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.