Android 布局可以';找不到

Android 布局可以';找不到,android,android-layout,Android,Android Layout,当我使用以下行时: LinearLayout layoutRoot = (LinearLayout) findViewById (R.id.layoutRoot); 它给出一个错误,说明无法解析R.id.layoutRoot。 这意味着什么?检查您的R.java文件(位于gen目录中),您将看到布局标识不属于id类,而是属于layout类 public static final class id { } public static final class layou

当我使用以下行时:

LinearLayout layoutRoot = (LinearLayout) findViewById (R.id.layoutRoot); 
它给出一个错误,说明无法解析
R.id.layoutRoot。


这意味着什么?

检查您的
R.java文件(位于gen目录中),您将看到布局标识不属于
id
类,而是属于
layout

    public static final class id {

    }
    public static final class layout {
        // Layouts are here...
    }

因此,它应该是:
R.layout.layoutRoot

验证在导入中,您是否有如下内容:

import com.myproject.R
而不是

import android.R
保存项目
从svn中排除bin、gen(如果您使用它)
提交、更新(如果使用svn)
干净的

尝试重新构建。如果不起作用:

删除gen,bin
拯救


建造

您能告诉我们您得到的确切错误以及在代码中调用setContentView()的位置吗?View content=findViewById(R.layout.layoutRoot);位图位图=content.getDrawingCache();这是代码,基本上我想截屏并保存它。我查看了layout类,它里面没有layoutroot,你真的有一个名为layoutroot.xml的布局吗?