(1)int width,height;

  WindowManager windowManager = getWindowManager();
  Display display = windowManager.getDefaultDisplay();
  screenWidth = display.getWidth();
  screenHeight = display.getHeight();
 (2)int width,height;

        DisplayMetrics displayMetrics = new DisplayMetrics();  
        this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);   
        height = displayMetrics.heightPixels;   
        width = displayMetrics.widthPixels;

其实是很简单的一个事,由于很多人都闻到这个问题!所以这里就把代码写出来,希望对大家有所帮助!

int screenWidth,screenHeight;

WindowManager windowManager = getWindowManager();

Display display = windowManager.getDefaultDisplay();
screenWidth = display.getWidth();
screenHeight = display.getHeight();

就这样就得到屏幕的快读和高度!

告诉大家一个小技巧:模拟器上按CTRL+F11(F12)--效果自己看!