Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)

Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)
解决方案
KeyEventCompat类(我项目中用它的hasNoModifiers方法)最后查看源码 才知道这个hasNoModifiers方法已经被KeyEvent实现了。 贴出源码:

public boolean executeKeyEvent(KeyEvent event) {
//报错地方
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
//                  if (KeyEventCompat.hasNoModifiers(event)) {
//                      handled = arrowScroll(FOCUS_FORWARD);
//                  } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
//                      handled = arrowScroll(FOCUS_BACKWARD);
//                  }


//                  http://blog.csdn.net/lrpshuai/article/details/78392872

//正确代码
                    if (event.hasNoModifiers()) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
}
原文地址:https://www.cnblogs.com/wzqnxd/p/9044390.html