Skip to content Skip to sidebar Skip to footer

Objectanimator Causes Imageview To Disappear

I'm working on animating an ImageView in Android (API 19), using ObjectAnimator. I've got everything working well, and it displays perfectly on a Galaxy S3, but on my Nexus 7 (2013

Solution 1:

Try to use: image.setCameraDistance(float) method.

From documentation:

The camera's distance affects 3D transformations, for instance rotations around the X and Y axis. If the rotationX or rotationY properties are changed and this view is large (more than half the size of the screen), it is recommended to always use a camera distance that's greater than the height (X axis rotation) or the width (Y axis rotation) of this view.

If you want to specify a distance that leads to visually consistent results across various densities, use the following formula:

float scale = context.getResources().getDisplayMetrics().density;
 view.setCameraDistance(distance * scale);

Post a Comment for "Objectanimator Causes Imageview To Disappear"