Monday, April 7, 2014

How to switch between the two animation activity?


Original problem from the CSDN quiz channels, more solutions, see: http://ask.csdn.net/questions / 1354
I want to achieve when you change activity, sliding from left to right to achieve the effect. I use the following code, but did not get the desired effect. Please help me look.

java files

 super.onCreate (savedInstanceState); 
overridePendingTransition (R.anim.fadein, R.anim.fadeout);
setContentView (R.layout.main);


In the res / anim directory two files
fadein.xml

  
xmlns: android = "http://schemas.android.com/apk/res/android"
android: duration = "5000"
android: fromAlpha = "0.0"
android: interpolator = "@ android: anim / slide_out_right"
android: toAlpha = "1.0">


fadeout.xml

  
xmlns: android = "http://schemas.android.com/apk/res/android"
android: duration = "5000"
android: fromAlpha = "0.0"
android: interpolator = "@ android: anim / slide_in_left"
android: toAlpha = "1.0">


Solution:

 protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.splashscreen);

new Handler (). postDelayed (new Runnable () {
public void run () {

/ * Create an intent that will start the main activity. * /
Intent mainIntent = new Intent (SplashScreen.this,
ConnectedActivity.class);
mainIntent.putExtra ("id", "1");

/ / SplashScreen.this.startActivity (mainIntent);
startActivity (mainIntent);
/ * Finish splash activity so user cant go back to it. * /
SplashScreen.this.finish ();

/ * Apply our splash exit (fade out) and main
entry (fade in) animation transitions. * /
overridePendingTransition (R.anim.mainfadein, R.anim.splashfadeout);
}
}, SPLASH_DISPLAY_TIME);
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
thanks and useful

Reply:

After reading, take away!
Reply:

Reply:

Reply:

Reply:
Multi worth learning,
Reply:
Landlord mighty. . . . . .
Reply:

Reply:
Good post, thank you
Reply:
The reply was deleted administrator at 2013-02-17 08:39:00

Reply:
Learning, thank you
Reply:
Worth learning!!
Reply:
First close up, again research!
Reply:
Bad good post, fine!
Reply:

Reply:

Reply:

Reply:

Reply:
Worthy of discussion, study
Reply:
Landlord mighty. . . . . .
Reply:
The reply was deleted administrator at 2013-02-17 14:45:41

Reply:
I came Study
Reply:
I came Study
Reply:
Well, it is worth learning
Reply:
I have the same problem some phones need to manually open the animation either no response
Reply:

Reply:
collection of a
Reply:
The reply was deleted administrator at 2013-02-18 08:59:20

Reply:
The reply was deleted administrator at 2013-02-18 08:59:20

Reply:
cited 26 floor franzhong reply:


Have not seen you in a long Q & A activity le
Reply:
The reply was deleted administrator at 2013-02-18 14:51:36

Reply:

Reply:

Reply:

Reply:

Reply:
Back under test collection
Reply:

Reply:
If I want to drag on when you open a new Activity and based on gestures to move, release and then determine whether to switch to the displacement according to how to do it?
Reply:

Reply:
Thank you, good post
Reply:
Use the refresh control interface handler

No comments:

Post a Comment