<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_rounded_loading"
android:duration="1000"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite" />
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Accessing the layout components to be displayed.
rootView = inflater.inflate(R.layout.fragment_loading, container, false);
ivLoading= (ImageView) rootView.findViewById(R.id.ivLoading);
RotateAnimation rotateAnimation = new RotateAnimation(
0,//float: Rotation offset to apply at the start of the animation.
360,//float: Rotation offset to apply at the end of the animation.
Animation.RELATIVE_TO_SELF,//int: Specifies how pivotXValue should be interpreted
0.5f,//float: The X coordinate of the point about which the object is being rotated
Animation.RELATIVE_TO_SELF,//int: Specifies how pivotYValue should be interpreted
0.5f//float: The Y coordinate of the point about which the object is being rotated
);
rotateAnimation.setDuration(1500);//How long this animation should last.
rotateAnimation.setRepeatCount(Animation.INFINITE);//Sets how many times the animation should be repeated.
rotateAnimation.setInterpolator(new LinearInterpolator());//Sets the acceleration curve for this animation.
ivLoading.startAnimation(rotateAnimation);
return rootView;
}