Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “错误”;无法解析符号';mBlockLayoutRequests&x27&引用;_Java - Fatal编程技术网

Java “错误”;无法解析符号';mBlockLayoutRequests&x27&引用;

Java “错误”;无法解析符号';mBlockLayoutRequests&x27&引用;,java,Java,在我的类ListView中,我收到错误消息:“无法解析符号'mBlockLayoutRequests'”。(带有错误消息的源代码:) mBlockLayoutRequests在我的类AdapterView()中声明,它由ListView继承: boolean mBlockLayoutRequests = false; 当我单击时,我会收到消息“找不到要转到的声明”。 我的代码中有错误吗?如何修复此错误?mBlockLayoutRequest字段是包专用字段。如果两个类位于不同的包中,则List

在我的类
ListView
中,我收到错误消息:“无法解析符号'mBlockLayoutRequests'”。(带有错误消息的源代码:)

mBlockLayoutRequests
在我的类
AdapterView
()中声明,它由
ListView
继承:

boolean mBlockLayoutRequests = false;
当我单击时,我会收到消息“找不到要转到的声明”。
我的代码中有错误吗?如何修复此错误?

mBlockLayoutRequest字段是包专用字段。如果两个类位于不同的包中,则
ListView
无法访问此字段。必须至少对其进行保护:

protected boolean mBlockLayoutRequest = false;

根据您的屏幕截图,
super
参考也有一个错误。当然,请确保
ListView
实际上继承了
AdapterView
(即既不是私有的,也不是最终的)。

谢谢您的回答。ListView和AdapterView位于android.widget包中,ListView可以调用mBlockLayoutRequest。如果mBlockLayoutRequest是私有的,则ListView类无法访问mBlockLayoutRequest,对吗?我更新了答案。如果两个类位于同一个包中,则可以访问包专用字段。只有
private
字段永远无法从外部访问。是的,你说得对!ListView实际上继承自从AdapterView继承的AbsListView。ListView和AdapterView在同一个包中,其名称为android.widget。您可以使用网站grepcode.com搜索这两个类。代码很好!但为什么它提示:“无法解析符号…”,我应该怎么做才能修复它?这个库代码不编译吗?那么,还有别的问题。可能是错误的编译器版本。在您的问题下查看我的评论,并通过编辑您的问题来回答。您的代码中还有许多其他错误。也许您应该发布这两个类的声明方式(包、修饰符、继承子句)和前几条错误消息,而不是代码中的任意错误。