android判断横竖屏

    public boolean isScreenChange(){
        Configuration mConfiguration = this.getResources().getConfiguration(); //获取设置的配置信息
        int ori = mConfiguration.orientation ; //获取屏幕方向
        if(ori == mConfiguration.ORIENTATION_LANDSCAPE){
            return true;
        }else if(ori == mConfiguration.ORIENTATION_PORTRAIT){
            return false;
        }
        return false;
    }

  

      Display display = getWindowManager().getDefaultDisplay();
            int xxx = display.getWidth();
            int yyy = display.getHeight();
            if(xxx>yyy){
                
            }else{
                
            }

  

原文地址:https://www.cnblogs.com/wcyMiracle/p/13428481.html