正常的判断屏幕方向的代码: /** 获取屏幕是否是竖屏 * @return */ @SuppressLint("SwitchIntDef") public boolean isScreenPortrait(){ int or = getRequestedOrientation(); switch (or) { case ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE :// 横屏 case ActivityInfo.SCREEN_ORIENTATIO…
void android.app.Activity.setRequestedOrientation(int requestedOrientation) 官方API解释: Change the desired orientation of this activity. If the activity is currently in the foreground or otherwise impacting the screen orientation, the screen will…