【问题标题】:adapter java class is not recognizing the layout files in android适配器 java 类无法识别 android 中的布局文件
【发布时间】: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 让评论成为评论...谢谢

标签: android layout


【解决方案1】:

导入 yourPackageName.R 类...并确保您有名为 movie_item 的 xml 布局

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-04
    • 2020-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多