码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2018-05-16 10:55:55      阅读:1394      评论:0      收藏:0      [点我收藏+]

标签:pre   else   asm   resolve   details   war   handle   public   com   

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找不到)

标签:pre   else   asm   resolve   details   war   handle   public   com   

原文地址:https://www.cnblogs.com/wzqnxd/p/9044390.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!