Android page switching animation effect

Source: Internet
Author: User

For example:

Animation animation1 = animationutils. loadanimation (homeactivity. This, R. anim. my_rotate_action );

Searchimageview. startanimation (animation1 );

 

Overridependingtransition () after 2.0 ()
Which contains two parameters. One is the entry of the previous activity that exits the activity,

 

@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. splashscreen );
 
New handler (). postdelayed (New runnable (){
@ Override
Public void run (){
Intent mainintent = new intent (splashscreen. This, androidnews. Class );
Splashscreen. This. startactivity (mainintent );
Splashscreen. This. Finish ();
 
Overridependingtransition (R. anim. mainfadein,
R. anim. splashfadeout );
}
},3000 );
}

The above code is only part of the pop-up Screen

Getwindow
().
Setwindowanimations
(
Int

);
 
This is no better, but it can also

 

Fade in and out

Overridependingtransition (Android. R. anim. fade_in, Android. R. anim. fade_out );

Effect of sliding from left to right

Overridependingtransition (Android. R. anim. slide_in_left, Android. R. anim. slide_out_right );

Zoomin and zoomout are implemented, which is similar to the entry and exit effects of the iPhone.

Overridependingtransition (R. anim. zoomin, R. anim. zoomout );

Create a zoomin. xml file

<? XML version = "1.0" encoding = "UTF-8"?>
<Set xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: interpolator = "@ Android: anim/decelerate_interpolator">
<Scale Android: fromxscale = "2.0" Android: toxscale = "1.0"
Android: fromyscale = "2.0" Android: toyscale = "1.0"
Android: Ready Tx = "50% P" Android: Ready ty = "50% P"
Android: Duration = "@ Android: integer/config_mediumanimtime"/>
</Set>

Create a zoomout. xml file

<? XML version = "1.0" encoding = "UTF-8"?>
<Set xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: interpolator = "@ Android: anim/decelerate_interpolator"
Android: zadjustment = "TOP">
<Scale Android: fromxscale = "1.0" Android: toxscale = ". 5"
Android: fromyscale = "1.0" Android: toyscale = ". 5"
Android: Ready Tx = "50% P" Android: Ready ty = "50% P"
Android: Duration = "@ Android: integer/config_mediumanimtime"/>
<Alpha Android: fromalpha = "1.0" Android: toalpha = "0"
Android: Duration = "@ Android: integer/config_mediumanimtime"/>
</Set>

 

 

 



 

 


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.