Android 取得使用者的螢幕大小

How to get user's screen height and width?
加入下面的code,即可取得使用者的螢幕高度和寬度
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);  
 Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();   
 int width  = display.getWidth();  
 int height = display.getHeight();  

沒有留言:

張貼留言