android 获取屏幕的方向

Configuration newConfig = getResources().getConfiguration(); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){ //横屏 }else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ //竖屏 }else if(newConfig.hardKeyboardHidden == Configuration.KEYBOARDHIDDEN_NO){ //键盘没关闭。屏幕方向为横屏 }else if(newConfig.hardKeyboardHidden == Configuration.KEYBOARDHIDDEN_YES){ //键盘关闭。屏幕方向为竖屏 } 

你可能感兴趣的:(android)