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

透明状态栏下,setSystemUiVisibility之后键盘状态监听有问题 #101

Open
HourInTheSun opened this issue Dec 8, 2018 · 6 comments

Comments

@HourInTheSun
Copy link

使用translucent属性后,如果window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR),会导致actionBarOverlayLayout.getPaddingTop()为0,软键盘监听都不正常了,有什么办法解决吗

@HourInTheSun
Copy link
Author

HourInTheSun commented Jun 15, 2019

刚才又看了下这个问题,顺便翻了下issues,发现很多人有遇到,就是系统键盘panel切换到自定义panel时会闪一下,基本都确定这段代码有问题:KeyboardUtil.calculateKeyboardShowing()
final int phoneDisplayHeight = contentView.getResources().getDisplayMetrics().heightPixels;
if (!isTranslucentStatus && phoneDisplayHeight == actionBarOverlayLayoutHeight) {
// no space to settle down the status bar, switch to fullscreen,
// only in the case of paused and opened the fullscreen page.
Log.w(TAG, String.format("skip the keyboard status calculate, the current"
+ " activity is paused. and phone-display-height %d,"
+ " root-height+actionbar-height %d", phoneDisplayHeight, actionBarOverlayLayoutHeight));
return;
}
注释掉之后就好了,不影响其他功能。
我说下我这边情况,设置了透明状态栏,isTranslucentStatus条件判断有问题从而执行了这段代码,跳过了计算。跟进看到isTranslucentStatus由ViewUtil.isTranslucentStatus()方法计算,该方法在5.0及以上的机型中判断有问题,因为设置透明状态栏方法有变化。修改这个判断方法也可行。其他issues中说的兼容等问题,我感觉也是这里判断的问题,而不是兼容性。

@jackyHuangH
Copy link

我使用的是ImmersionBar适配沉浸式状态栏,同样遇到异常问题

@HourInTheSun
Copy link
Author

我使用的是ImmersionBar适配沉浸式状态栏,同样遇到异常问题

目前看来最简单的做法就是注掉上面这段代码了

@jackyHuangH
Copy link

我使用的是ImmersionBar适配沉浸式状态栏,同样遇到异常问题

目前看来最简单的做法就是注掉上面这段代码了

不不不,我说的是注释掉以后同样存在这个问题,应该是有冲突,我不用沉浸式就没事

@HourInTheSun
Copy link
Author

我使用的是ImmersionBar适配沉浸式状态栏,同样遇到异常问题

目前看来最简单的做法就是注掉上面这段代码了

不不不,我说的是注释掉以后同样存在这个问题,应该是有冲突,我不用沉浸式就没事

哦,我是自己处理的状态栏,可以正常用

@YummyLau
Copy link

支持沉浸式哈。 https://github.com/YummyLau/PanelSwitchHelper 可以试试

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