Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contentView.getResources() .getDisplayMetrics().heightPixels 返回值不是真正的height #86

Open
qyf123 opened this issue Apr 20, 2018 · 2 comments

Comments

@qyf123
Copy link

qyf123 commented Apr 20, 2018

image

您好,我的项目里在OPPO R15(1080x2280)上, 这个地方返回的heightPixels 是2200,结果就是 phoneDisplayHeight = actionBarOverlayLayoutHeight; 导致会进入上图的地方,最后无法回调到onKeyboardShowing ; 非全屏,非沉浸式;

但是在这个demo里,却是没问题的,

搞不懂了,求破;

@Heycz
Copy link

Heycz commented May 11, 2018

我也发现个别机器获取这个高度和实际并不一样,导致出现问题,我的是魅族手机,getResources().getDisplayMetrics().heightPixels获取的高度并不是实际手机的高度
DisplayMetrics metrics = new DisplayMetrics(); ((Activity)contentView.getContext()).getWindowManager().getDefaultDisplay().getRealMetrics(metrics); metrics.heightPixels但是我这样去拿高度就准确了

@Heycz
Copy link

Heycz commented May 11, 2018

@qyf123 应该是你工程内修改了Resources
我排查了一下发现
image
当初为了多语言在N以上设置了context.createConfigurationContext,导致Resources的高度变了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants