This defines a rotation around the y-axis from 0 to 360 degrees that will take 500 milliseconds. The propertyName attribute defines the property that should be animated. While rotationY is also a valid view attribute that can be specified in a layout, the ObjectAnimator does not make use of this. The argument type of the method is specified using the valueType attribute. The animation has to be applied to an object. We have applied it to an ImageView that is centred on the screen. We can use a Relative Layout for this purpose.
The first line in the method flipOnVertical simply retrieves the ImageView from the layout. The second line creates an Animator object from the XML resource. The method takes a context and a resource id that references the animation . Next we define the target object for the animation using Animator.setTarget. Finally Animator.start will start the animation.