In my app I am using Rotate3dAnimation to show a Google map. The code is working fine, but the animation is not smooth, some lines are also visible while rotating the view.
I will just give a small hint; however right now I am so busy at work I can not implement this.
The steps are
This I believe will maximize the performance.
I will try to write some code later.
CODE
View longLivingReference; //keep a reference
private void applyRotation(int position, float start, float end) {
longLivingReference = findViewById(R.id.event_container);
longLivingReference .setDrawingCacheEnabled(true);
Bitmap bitmapForAnimation = Bitmap.createBitmap(longLivingReference.getDrawingCache());
ImageView iv = new ImageView(mContext);
iv = new ImageView(mContext);
iv.setImageBitmap(bitmapForAnimation);
setContentView(iv);
final float centerX = mContainer.getWidth() / 2.0f;
final float centerY = mContainer.getHeight() / 2.0f;
final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end, centerX, centerY, 310.0f, true);
rotation.setDuration(500);
rotation.setFillAfter(true);
rotation.setInterpolator(new AccelerateInterpolator());
rotation.setAnimationListener(yourAnimationListener {
//whatever your AnimationListener is, you can call super.onAnimationEnd if needed
@Override
public void onAnimationEnd(Animation animation) {
setContentView(longLivingReference);
}
});
iv.startAnimation(rotation);
}