Friday, 15 August 2014

android - Animation onresume activity -


There is a sliding animation between the two activities in the onCreate method, I am using it:

  Override pending transition (R.anim.slide_in, R.anim.slide_out);  

and onResume method:

  @override secure zero over regeneration () {this.overridePendingTransition (R.anim.slide_out , R.anim.slide_in); Super.onResume (); }  

slide_in.xml

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Translate xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Period = "@ Android: Integer / Config_Long Anim Time" Android: fromXDelta = "100% p" Android: toXDelta = " 0% p "& gt;  

slide_out.xml

  & lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; Translate xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Period = "@ Android: Integer / Config_Long Anim Time" Android: fromXDelta = "0% p" Android: toXDelta = " -100% P "& gt; & Lt; / Translation tax & gt;  

The problem is: When I return to activity, it shows the same animation (right to left). I want to reverse it, what am I doing wrong here?

add two more animation files

slide_in_back:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Translate xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Period = "@ Android: Integer / Config_Long Anime Time" Android: fromXDelta = "- 100% p" Android: toXDelta = "0% p" & gt; & Lt; / Translation tax & gt;  

slide_out_back:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Translate xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Period = "@ Android: Integer / Config_Long Anim Time" Android: fromXDelta = "0% p" Android: toXDelta = " 100% P "& gt; & Lt; / Translation tax & gt;  

Call when starting the activity:

  Override pending transition (R.anim.slide_in, R.anim.slide_out); Call  

Backdrop () method or call () when finished in any activity:

  Override pending transition (R.anim.slide_in_back , R.anim.slide_out_back);  

Here's a tutorial to see:

Hope it's helpful!


No comments:

Post a Comment