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);
                    }
}
阅读更多
文章标签: android
个人分类: 技术提升
相关热词: cannot 微信cannot
上一篇AndroidStudio升到最新版本(3.1.2)之后
下一篇如何配置tomcat环境变量
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭