【发布时间】:2014-01-25 06:16:05
【问题描述】:
我正在用 android 开发一个电影播放器应用程序。我的适配器 java 类无法识别布局文件。所有 R.id/R.layout 语法都在抛出错误。
convertView = layoutInflater.inflate(R.layout.movie_item, null);
movie_item can not be resolved or is not a field. (movie_item is a layout)
ImageView thumbnail = (ImageView) convertView.findViewById(R.id.thumbnail);
thumbnail can not be resolved or is not a field. (thumbnail is an image view in movie_item layout)
我的 .xml 文件没有任何错误。 我的适配器类之前导入了 android.r。我删除了它并清理了项目。它仍然显示相同的错误。
【问题讨论】:
-
导入 yourPackageName.R 类...并确保您的 xml 布局名称为
movie_item -
已解决.. 非常感谢 Gopal :)
-
@GopalRao:如果是答案,请将其作为答案发布。 :)
-
@Qantas94Heavy 让评论成为评论...谢谢