Android Activity Interface Jump Animation

Source: Internet
Author: User

Implement activity interface Jump animation

1. After the StartActivity method, add:

Overridependingtransition (R.anim.pull_in_right, R.anim.pull_out_left) this method.

If R.anim doesn't exist, create a new Anim folder under Res

r.anim.pull_in_right// also create a new Pull_in_left.xml file under the Anim file

<scale xmlns:android= "Http://schemas.android.com/apk/res/android"
android:duration= "@integer/animtime"
Android:fromxscale= "0%"
Android:fromyscale= "100%"
android:pivotx= "100%"
Android:pivoty= "100%"
Android:toxscale= "100%"
android:toyscale= "100%"/>

R.anim.pull_out_left

<set xmlns:android= "Http://schemas.android.com/apk/res/android" >
<scale
android:duration= "@integer/animtime"
Android:fromxscale= "100%"
Android:fromyscale= "100%"
android:pivotx= "0%"
Android:pivoty= "0%"
Android:toxscale= "0%"
android:toyscale= "100%"/>
<alpha
android:duration= "@integer/animtime"
Android:fromalpha= "1"
Android:toalpha= "0.2"
>
</alpha>
</set>

2. If you want to return the animation, rewrite finish after Super.finish () to add:

Overridependingtransition (R.anim.pull_in_left, r.anim.pull_out_right);

R.anim.pull_in_left

<scale xmlns:android= "Http://schemas.android.com/apk/res/android"
android:duration= "@integer/animtime"
Android:fromxscale= "0%"
Android:fromyscale= "100%"
android:pivotx= "0%"
Android:pivoty= "0%"
Android:toxscale= "100%"
android:toyscale= "100%"/>

R.anim.pull_out_right

<set xmlns:android= "Http://schemas.android.com/apk/res/android" >
<scale
android:duration= "@integer/animtime"
Android:fromxscale= "100%"
Android:fromyscale= "100%"
android:pivotx= "100%"
Android:pivoty= "100%"
Android:toxscale= "0%"
android:toyscale= "100%"/>
<alpha
android:duration= "@integer/animtime"
Android:fromalpha= "1"
Android:toalpha= "0.2"
>
</alpha>
</set>

Android Activity Interface Jump Animation

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.