I’ve just started working with Mono for Android, and am having trouble getting a transition animation to work on my device. It works fine in the Android emulator.
The device is a HTC Sensation, with all Animations enabled.
My animation XML files are:
slide_in_right.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="100%p" android:toXDelta="0%p" android:duration="200" android:startOffset="0" />
</set>
slide_out_left.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="200" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="200" android:startOffset="0" />
</set>
The animation is called here:
Intent intent = new Intent(this, typeof(Activity2));
StartActivity(intent);
OverridePendingTransition(Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);
In the emulator, this results in the first view sliding out to the left while the new view slides in from the right.
When I upload to the device and run it, there is no sliding, the first view fades out and the second just pops up in its place.
I tried commenting out the OverridePendingTransition line to see if the fade transition was working and the sliding one not, but there was no difference. So it appears that the problem is with the OverridePendingTransition rather than any individual part of the animation.
I don’t have any other Android devices to test this on, so don’t know if it’s a particular HTC problem.
All animation is turned on in the device settings; Facebook and other apps seem to have no problem with sliding between views.
Any help would be much appreciated.
Bryan.
I’ve managed to solve this problem. In case anyone else is having the same issue, the solution was to add support for largeScreen and anyDensity into the manifest file:
All animations now work fine.