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

使用今日头条屏幕适配方案会导致状态栏和导航栏高度不对 #29

Open
jielundewode opened this issue Feb 5, 2021 · 5 comments

Comments

@jielundewode
Copy link

Dingtalk_20210205100002
如图,状态栏是红色的,去掉改变状态栏颜色代码,状态栏高度是正常的

@Zackratos
Copy link
Owner

贴一下代码看看

@jielundewode
Copy link
Author

代码我已经移除,不过就是你demo中的代码

@jielundewode
Copy link
Author

小米 原生设备上没有此问题

@Zackratos
Copy link
Owner

好的,有机会用华为手机试试

@twufive
Copy link

twufive commented Jun 1, 2021

@jielundewode 是因为使用今日头条的适配方案,修改了Resources,导致拿到的状态栏高度不对。
扩展类 ultimatebarx\extension\Context.kt
private fun Context.getBarHeight(name: String): Int {
val height1 = resources.getDimensionPixelSize(resources.getIdentifier(name, "dimen", "android"))
val height2 = Resources.getSystem()
.getDimensionPixelSize(Resources.getSystem().getIdentifier(name, "dimen", "android"))
return if (height1 > height2) height1 else height2
}
@Zackratos 计算出来的值都是偏小,我这边直接通过两种方式获取高度,选大的。

@Zackratos Zackratos changed the title 华为emui 10 11版本状态栏高度异常 使用今日头条屏幕适配方案会导致状态栏和导航栏高度不对 Aug 21, 2021
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

3 participants