Question

I have the following code, that adds views to ViewAnimator

View step1 = View.inflate(activity, R.layout.step_1, null);
View step2 = View.inflate(activity, R.layout.step_2, null);
viewAnimator.addView(step1);
viewAnimator.addView(step2);
viewAnimator.setInAnimation(activity, R.anim.slide_in);
viewAnimator.setOutAnimation(activity, R.anim.slide_out);

and the following xmls

slide_in:

<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false">
    <translate
            android:fromXDelta="100%" android:toXDelta="0%"
            android:fromYDelta="0%" android:toYDelta="0%"
            android:duration="700" />
</set>

slide_out:

<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false">
    <translate android:fromXDelta="0%" android:toXDelta="-100%"
               android:fromYDelta="0%" android:toYDelta="0%"
               android:duration="700"/>
</set>

Now, all works fine, however the performance of the animation looks sluggish and slow comparing to the native animations on my phone (Samsung galaxy S).

I use API level 8, can I use any hardware acceleration, or should I change my approach for the whole concept?

Thanks a bundle

Was it helpful?

Solution

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/> was missing from my manifest file, once added the animation is super smooth.

OTHER TIPS

Its a 2D animation only, this means it is as in Javascript in the IE7 Web Browser.

To get faster animations the only way is to do it with (OpenGL) RenderScript to get HW Accel through 3D when using API's < v14 (ICS).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top