Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)
阿新 • • 發佈:2018-05-16
blog forward CA res tco sdn hand andro exe
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); } }
Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)