【问题标题】:Android scrolling makes whole screen blueAndroid滚动使整个屏幕变蓝
【发布时间】:2018-05-18 06:26:20
【问题描述】:
我无法复制这一点,但有人知道什么可能导致 Android 设备上的整个屏幕变成浅蓝色吗?它似乎与选择单选按钮然后滚动有关。它发生在装有 Android 8 的 Nexus 5x 上。
这是它的样子:
我只听说过发生这种情况的另一个实例。它可能是特定于设备的吗?奇怪的是,一旦发生,它似乎会保持这种状态,尽管用户说它有些间歇性。
更新:
这似乎只发生在 Android 8 上,如果这对任何人都有帮助的话......
【问题讨论】:
标签:
android
scroll
highlight
【解决方案1】:
所以,我最终找到了有问题的代码。我确认这仅发生在 Android 8 设备上,也许只有三星?有问题的代码是:
mFormScrollView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
mFormScrollView.setFocusable(true);
mFormScrollView.setFocusableInTouchMode(true);
// Hide the keyboard when moving the screen up or down. This should only
// be an issue when
// on a text edit field. Also disable focus jump using
// "requestFocusFromTouch"
mFormScrollView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_DOWN) {
Utilities.hideKeyBoard(FormActivity.this, view);
}
// Keeps screen from jumping to nearest EditText
// view.requestFocusFromTouch();
return false;
}
});
有问题的行已被注释掉 - view.requestFocusFromTouch() 方法,该方法旨在防止屏幕在键盘被隐藏和焦点丢失时自动跳转到下一个文本字段。在 Android 8 上不会发生这种情况,但我需要使用旧版本进行验证。