简体   繁体   English

错误“无法解析符号‘mBlockLayoutRequests’”

[英]Error "Cannot resolve symbol 'mBlockLayoutRequests'"

In my class ListView I get the error message: "Cannot resolve symbol 'mBlockLayoutRequests'".在我的类ListView我收到错误消息:“无法解析符号‘mBlockLayoutRequests’”。 (source code with error message: link ) (带有错误信息的源代码:链接

mBlockLayoutRequests is declared in my class AdapterView ( source code ), which is inherited by ListView : mBlockLayoutRequests在我的类AdapterView源代码)中声明,由ListView继承:

boolean mBlockLayoutRequests = false;

When i click, I get the message "Cannot find declaration to go to".当我单击时,我收到消息“找不到要转到的声明”。 Is there an error in my code?我的代码中有错误吗? What should i do to fix this error?我应该怎么做才能修复这个错误?

The mBlockLayoutRequest field is package-private. mBlockLayoutRequest字段是包私有的。 If both classes are in different packages, then ListView cannot access this field.如果两个类在不同的包中,则ListView无法访问此字段。 It has to be at least protected:它至少必须受到保护:

protected boolean mBlockLayoutRequest = false;

According to you screen shot, the super reference also has an error.根据你的截图, super引用也有错误。 Of course, make sure that ListView actually inherits from AdapterView (ie is neither private nor final).当然,确保ListView实际上是从AdapterView继承的(即既不是私有的也不是最终的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM