ViewUtils.java 文件源码

java
阅读 49 收藏 0 点赞 0 评论 0

项目:gmlrva 作者:
/**
 * Procedure meant to provide the device's screen height in pixels.
 * @param context the application's current {@link Context}.
 * @return an Integer value representing the device's screen height, in pixels.
 */
@IntRange(from = 0) public static int getDeviceScreenHeight(@NonNull final Context context) {
    synchronized (ViewUtils.class) {
        if (sDeviceScreenHeight == 0) {
            final WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
            if (windowManager != null) {
                final Display display = windowManager.getDefaultDisplay();
                final Point size = new Point();
                display.getSize(size);
                sDeviceScreenHeight = size.y;
            }
        }
    }
    return sDeviceScreenHeight;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号