0

In the Apk Demos for HoneyComb under Views/Animation/3D Transition I see that when we click the image list, they show with an animation of turning the ImageView.

Is this possible for transitioninng between activities?

Ex: Opned app A. Click on a list item, this click opens a new activity.(Here I want the new activity that is displayed to look like as if it was hiding in the back)

Activity B is rotated into the front of the screen from Activity A.

Thanks, Sana.

Sana
  • 9,895
  • 15
  • 59
  • 87

3 Answers3

4

Yes you can change the animation when your activity is started, I'm not sure but you could probably get a 3D effect with it. See Applying Styles and Themes - you need to change the android:windowAnimationStyle of your theme.

Your themes.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="MyApplicationTheme" parent="@android:style/Theme">
    <item name="android:windowAnimationStyle">@style/ActivityAnimation</item>
</style>

</resources>

Your styles.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="ActivityAnimation">
    <item name="android:activityOpenEnterAnimation">@anim/activity_open_enter</item>
    <item name="android:activityOpenExitAnimation">@anim/activity_open_exit</item>
    <item name="android:activityCloseEnterAnimation">@anim/activity_close_enter</item>
    <item name="android:activityCloseExitAnimation">@anim/activity_close_exit</item>
    <item name="android:taskOpenEnterAnimation">@anim/task_open_enter</item>
    <item name="android:taskOpenExitAnimation">@anim/task_open_exit</item>
    <item name="android:taskCloseEnterAnimation">@anim/task_close_enter</item>
    <item name="android:taskCloseExitAnimation">@anim/task_close_exit</item>
    <item name="android:taskToFrontEnterAnimation">@anim/task_open_enter</item>
    <item name="android:taskToFrontExitAnimation">@anim/task_open_exit</item>
    <item name="android:taskToBackEnterAnimation">@anim/task_close_enter</item>
    <item name="android:taskToBackExitAnimation">@anim/task_close_exit</item>
    <item name="android:wallpaperOpenEnterAnimation">@anim/wallpaper_open_enter</item>
    <item name="android:wallpaperOpenExitAnimation">@anim/wallpaper_open_exit</item>
    <item name="android:wallpaperCloseEnterAnimation">@anim/wallpaper_close_enter</item>
    <item name="android:wallpaperCloseExitAnimation">@anim/wallpaper_close_exit</item>
    <item name="android:wallpaperIntraOpenEnterAnimation">@anim/wallpaper_intra_open_enter</item>
    <item name="android:wallpaperIntraOpenExitAnimation">@anim/wallpaper_intra_open_exit</item>
    <item name="android:wallpaperIntraCloseEnterAnimation">@anim/wallpaper_intra_close_enter</item>
    <item name="android:wallpaperIntraCloseExitAnimation">@anim/wallpaper_intra_close_exit</item>
</style> 

</resources>

Then set android:theme="@style/MyApplicationTheme in the <application> (applies to all activities) or <activity> tag (applies the theme to just that activity, and overrides the application theme if set) in your Android manifest.

Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
  • it just applies the theme, but it doesn't change the transitions. :( – Sana Mar 24 '11 at 20:14
  • and I defined for each @anim in my anims folder? – Sana Mar 24 '11 at 20:52
  • Yes, make animations called `activity_open_enter.xml`, `activity_open_exit.xml` in your anims folder. You can change the names of course, just remember to change the ones in your styles file to match. – Joseph Earl Mar 24 '11 at 20:58
  • android:theme="@style/MyTheme and android:windowAnimationStyle="@style/ActivityAnimation". What is the difference between the two? – Sana Mar 24 '11 at 22:06
  • the transformation happens only on the x and y axis. I am looking for animation on the z-axis as well. – Sana Mar 24 '11 at 23:24
  • Added more information in the post on how to apply the theme and style. But yes you probably only can use the animation on the X and Y axis. You could still use a skewing animation to give the effect of spinning. – Joseph Earl Mar 25 '11 at 00:51
1

This is a duplicate question... see question/answer here.

Or, a direct link to the android example here

Community
  • 1
  • 1
Brian ONeil
  • 4,229
  • 2
  • 23
  • 25
0

Currently I do not think Android provides ways to implement 3D transitions between activities.

Di Wang
  • 104
  • 6