-
Notifications
You must be signed in to change notification settings - Fork 168
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
addStatusBarTopPadding高度问题 #32
Comments
这个 if 不是为了排除 WRAP_CONTENT和MATCH_PARENT的情况的,而是因为 WRAP_CONTENT和MATCH_PARENT的情况下,View 高度是不确定的,所以必须在 post 中等 view 的高度确定之后再加上 StatusBar 的高度,另外,这个方法是为了在需要的情况下给 View 增加一个 StatusBar 的高度的,如果不需要,就不用调用这个方法 |
@Zackratos |
好像确实有这个问题,我下个版本尝试修复一下 |
@Zackratos 如果使用了 AdaptScreenUtils 适配, addStatusBarTopPadding这个方法状态栏的高度是不对的。 |
这时因为获取到的状态栏高度不对,跟这里说的不是同一个问题,这个属于 issues 29 的问题,可以关注那个 |
问题已解决,可以使用 0.6.1 版本 |
internal fun View.addStatusBarTopPadding() {
setPadding(paddingLeft, paddingTop + statusBarHeight, paddingRight, paddingBottom)
val lp = layoutParams
if (lp.height != ViewGroup.LayoutParams.MATCH_PARENT && lp.height != ViewGroup.LayoutParams.WRAP_CONTENT) {
lp.height += statusBarHeight
layoutParams = lp
return
}
post {
lp.height = height + statusBarHeight
layoutParams = lp
}
}
addStatusBarTopPadding这个方法if+post里执行的都一样,你想排除WRAP_CONTENT和MATCH_PARENT的情况不就失效了吗?目前我的布局height是WRAP_CONTENT,就多加了statusBarHeight。
The text was updated successfully, but these errors were encountered: