直接上代码
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) decorView.getLayoutParams();
//旋转
// layoutParams.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE;
//淡入淡出
// layoutParams.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_CROSSFADE;
//无动画
// layoutParams.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_JUMPCUT;
//无缝旋转模式
layoutParams.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
windowManager.updateViewLayout(decorView, layoutParams);