安卓 测量 屏幕 大小

时间:2021-01-24 22:34:21
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        DisplayMetrics dm = new DisplayMetrics();
        this.getWindowManager().getDefaultDisplay().getMetrics(dm);
        Log.i("123", dm.widthPixels+"W,,,,H,"+dm.heightPixels);

    }