开发者

Transition of Activity A to Activity B. Can this transition be like a rotation, instead of a regular Android activity show?

开发者 https://www.devze.com 2023-02-19 08:04 出处:网络
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.

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.


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.


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

Or, a direct link to the android example here


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

0

精彩评论

暂无评论...
验证码 换一张
取 消