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

得意犹堪夸世俗,诏黄新湿字如鸦。这篇文章主要讲述Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)相关的知识,希望能为你提供帮助。
【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); } }




    推荐阅读