获取屏幕宽度和高度并判断横竖屏

void f(){
 
 Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();

 int width = display.getWidth();
 int height = display.getHeight();
 int orientation = display.getOrientation();
 switch(orientation){
 case Configuration.ORIENTATION_PORTRAIT:
  //....
  break;
 case Configuration.ORIENTATION_LANDSCAPE:
  //...
  break;
 default :
  //...
  break;
 }
}

你可能感兴趣的:(F#)