Tuning Android: several common interface transitions

Disclaimer: This article is a blogger original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45136073/article/details/97158166

ActivityIt refers to a handover from one animation activityto jump to another activityanimation of.
It consists of two parts: the
part is the first activityanimation exit;
another part when the second activityanimation entry;
after the release of Android 2.0, has a function to help us achieve this animation. This function isoverridePendingTransition

@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 simply splash screen portion thereof.

getWindow (). setWindowAnimations ( int );    
getWindow (). setWindowAnimations ( int );

This is not the good but also can be.

Achieve the effect of a fade:

overridePendingTransition(R.anim.splash_screen_fade, R.anim.splash_screen_hold);

Achieve fade Effect 2:

overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);     

From left to right slip into effect:

overridePendingTransition(Android.R.anim.slide_in_left,android.R.anim.slide_out_right);     

Realization zoominand zoomouteffect, that is similar to the iphone entry and exit:

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

New 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:pivotX="50%p" android:pivotY="50%p"
           Android:duration="@android:integer/config_mediumAnimTime" />
</set>

New 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:pivotX="50%p" android:pivotY="50%p"
          Android:duration="@android:integer/config_mediumAnimTime" />
   <alpha Android:fromAlpha="1.0" android:toAlpha="0"
           Android:duration="@android:integer/config_mediumAnimTime"/>
</set>  

At last

If you see here, I feel well written articles on the point of a praise chant? Share forwarding and concern about my future will update the technology of dry cargo, thank you for your support! If you think there need to be improved, please give me a message. Will be serious inquiry, insufficiently corrected. Thank you.

There is a good old saying:
"than you are the best opponents in learning, your enemy in sharpening your girlfriends on a diet, the next Pharaoh in practice waist, we must continue to learn, or we'll be beyond the learner."
Of course a people learning is boring, but also a good learning atmosphere, so I set up a community learning exchanges to explore, welcomed everyone will work together to explore exchanges and common progress. There is some information collected, you may be interested to learn together and progress together!

Android counterparts for development, for everyone here put together some information, which share content, including but not limited to
[senior UI, performance optimization, mobile architect, NDK, hybrid development (ReactNative + Weex) micro letter applets, Flutter so the whole Android Advanced practice technology]
want to help you learn advanced upgrade, but also saves you the time to search for information online learning, but also can share with close friends to learn together!

+ Forwarding thumbs up, join the Android developer exchange group (820 198 451) to obtain small series for everyone included advanced data and interview exam

Here Insert Picture Description

+ Forwarding thumbs up, join the Android developer exchange group (820 198 451) to obtain small series for everyone included advanced data and interview exam

Android architects of the road is long, encourage each other with it!

Guess you like

Origin blog.csdn.net/weixin_45136073/article/details/97158166