Animated activity transition, diagonal slide.

Quickly share your Android Code Snippets here...

Animated activity transition, diagonal slide.

Postby XCaffeinated » Fri Jan 15, 2010 3:50 am

A user asked how to create a diagonal screen transition at Google Groups/Android-Beginners here. Based on my earlier tutorial I posted some example code there. You can read the whole post there, but the gist is:

From the tutorial, replace mainfadein.xml with diagslide_enter.xml:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <translate xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.  android:fromXDelta="-100%" android:toXDelta="0%"
  6.  
  7.  android:fromYDelta="-100%" android:toYDelta="0%"
  8.  
  9.  android:duration="2000" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

and replace splashfadeout.xml with diagslide_leave.xml:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <translate xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.  android:fromXDelta="0%" android:toXDelta="-100%"
  6.  
  7.  android:fromYDelta="0%" android:toYDelta="-100%"
  8.  
  9.  android:duration="2000" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

Add diagslide_enter.xml and diagslide_leave.xml to your /res/anim directory, and change the overridePendingTransition() statement to:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. overridePendingTransition(R.anim.diagslide_enter, R.anim.diagslide_leave);
Parsed in 0.029 seconds, using GeSHi 1.0.8.4

You can see more information, and a link to a YouTube video of this transition, in the original link.

Hope this helps!
XCaf
XCaffeinated
Developer
Developer
 
Posts: 25
Joined: Sun Nov 29, 2009 10:16 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 7 guests