0

I have 2 activities, I want the user thinks that they are back to back, like classic secret rotating walls in some old films: when user switches to second activity first one rotates from right to left, showing the back which is the second activity.

I'm really not good with animations, this is the first one I try..I made this xml file in res/anim:

Rotation 1:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
        android:toDegrees="-90"
        android:toYScale="0.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="1000"/>

Rotation 2 :

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-90"
        android:toDegrees="-180"
        android:toYScale="0.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="1000"/>

and in code, simply:

startActivity(matchIntent);
overridePendingTransition( R.anim.first_rotate, R.anim.second_rotate );

but I just obtain a fast flash as transition...and I set duration to 1000 too!

EDIT: I found my answer here: How to apply 3d transition between two activities in android? now the only problem left is that during animation background is default white..is there a way to set it to another color, for example red?

Community
  • 1
  • 1
Phate
  • 6,066
  • 15
  • 73
  • 138

1 Answers1

0

The white background you're seeing could be: 1. The first Activity's background. Try changing/adding a background to the parent layout of the activity. 2. It could be what's below the first Activity - i.e another Activity that opened the first one.

Hope this helps.

Givi
  • 3,283
  • 4
  • 20
  • 23