方法1:
Configuration cf= this.getResources().getConfiguration();
int ori = cf.orientation ;
if(ori == cf.ORIENTATION_LANDSCAPE){
// 横屏
}else if(ori == cf.ORIENTATION_PORTRAIT){
// 竖屏
}方法2:
DisplayMetrics dm = new DisplayMetrics();
mLauncher.getWindowManager().getDefaultDisplay().getMetrics(dm);
mWidth = dm.widthPixels;
mHeight = dm.heightPixels;if (mHeight > mWidth){
// 竖屏
}else{
// 横屏
}