android imageview animation lag

783 views Asked by At

I am having trouble with lagging animations in android. The animations work perfectly fine with ios but lag on android. i will post a simple example...

lets say make an imageView like..

`ImageView someView = new ImageView(context);`

then later in my code when i try and animate the imageview...

'someView.setDrawingCacheEnabled(true);
someView.setLayerType(View.LAYER_TYPE_HARDWARE,null);
someView.animate().scaleY(scaleY).scaleX(scaleX).x(dX).y(dY)
.setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    someView.setLayerType(LAYER_TYPE_NONE, null);
                }
                });`

My app(game) involves different overlapping views (no more than 3-4, but which I herd can slow down the animations) but there is no real work around. so i will run the animation above on like three different views at the same time...

I have added android:hardwareAccelerated="true" to my manifest file. I have a bunch of bunch of broadcast receivers so could that be a factor?

Im making a card game and the first couple of cards come out smooth but when i make them bigger and deal them then it starts to lag.

I feel like i have searched everywhere and tried all the little tips suggest to speed up the animations and make it more proficient.

when you have to animate different imageviews at the same time that are stacked what do you do??

thanks

-edit: for my imageview i also set the scale time to FIT_XY which i herd slows down animations, so what is a work around for this?

1

There are 1 answers

0
Sanket Berde On

Increase the duration of the animations to get a smoother effect try :

view.animate().alpha("1f").DO_WHATEVER.setDuration(700).start();