Creating a 3D flip animation in Android using XML

后端 未结 8 1794
萌比男神i
萌比男神i 2020-12-22 20:25

I have created a 3D flip of a view using this android tutorial However, I have done it programmatically and I would like to do it all in xml, if possible. I am not talking

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 20:49

    One of the better solution to flip the image with out use of the resource animation , is as follow:-

      ObjectAnimator animation = ObjectAnimator.ofFloat(YOUR_IMAGEVIEW, "rotationY", 0.0f, 360f);  // HERE 360 IS THE ANGLE OF ROTATE, YOU CAN USE 90, 180 IN PLACE OF IT,  ACCORDING TO YOURS REQUIREMENT 
    
      animation.setDuration(500); // HERE 500 IS THE DURATION OF THE ANIMATION, YOU CAN INCREASE OR DECREASE ACCORDING TO YOURS REQUIREMENT
      animation.setInterpolator(new AccelerateDecelerateInterpolator());
      animation.start();
    

提交回复
热议问题