if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ //横屏 } else { //竖屏 }