Android的全萤幕尺寸

Ard*_*nar 5 android screen-size

我想获取Android设备的屏幕尺寸。我正在使用这3个代码来执行此操作,但这给了我活动的大小;没有状态栏高度的大小。在高度为800px的平板电脑上,此代码为764px。36px转到底部的状态栏。

    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    final int width = size.x;
    final int height = size.y;



    Rect rectgle= new Rect();   
    Window window= getWindow();
    window.getDecorView().getWindowVisibleDisplayFrame(rectgle);
    int height2= rectgle.bottom;



    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int actualHeight = metrics.heightPixels;
Run Code Online (Sandbox Code Playgroud)

但是我需要一个代码,该代码可以给我 实际的屏幕尺寸。 不是活动的。有人可以帮我吗?谢谢。