获取屏幕宽高

 DisplayMetrics dm = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width = dm.widthPixels;
         int height = dm.heightPixels ; 
         System.out.println("当前宽度"+width);
         System.out.println("当前高"+height);  
         Toast.makeText(getApplicationContext(), "宽"+width+"高"+height, 1).show();

 

你可能感兴趣的:(Android控件)