keyeventcompat不存在的错误

迁移AndroidX后 KeyEventCompat这个类不见了

if (KeyEventCompat.hasNoModifiers(event)) {
    handled = arrowScroll(FOCUS_FORWARD);
} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
    handled = arrowScroll(FOCUS_BACKWARD);
}

修复方案:

if (event.hasNoModifiers()) {
    handled = arrowScroll(FOCUS_FORWARD);
} else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
    handled = arrowScroll(FOCUS_BACKWARD);
}

你可能感兴趣的:(keyeventcompat不存在的错误)