getWindowVisibleDisplayFrame() gives different values in Android 2.2, 2.3 (but not 2.3.3)

前端 未结 4 1239
执笔经年
执笔经年 2021-01-06 03:11

I\'ve got an Activity which uses

getWindow().getDecorView().getWindowVisibleDisplayFrame(rectangle);

to determine the useable

4条回答
  •  执笔经年
    2021-01-06 03:36

    So, I did this:

        Rect rectangle = new Rect();
        getWindow().getDecorView().getWindowVisibleDisplayFrame(rectangle);
        if(android.os.Build.VERSION.SDK_INT < 9  /* android.os.Build.VERSION_CODES.GINGERBREAD */ ) {
            // http://stackoverflow.com/questions/7659652/getwindowvisibledisplayframe-gives-different-values-in-android-2-2-2-3-but-no/7660204#7660204
            rectangle.top = 0;
        }
    

提交回复
热议问题