WindowManager mgr = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE));
int lastOrientation = mgr.getDefaultDisplay().getRotation();
activity.setRequestedOrientation(lastOrientation);
WindowManager mgr = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE));
int lastOrientation = mgr.getDefaultDisplay().getRotation();
activity.setRequestedOrientation(lastOrientation);
转载于:https://www.cnblogs.com/chenlong-50954265/p/3924548.html