找不到版式

| 当我使用以下行时:
LinearLayout layoutRoot = (LinearLayout) findViewById (R.id.layoutRoot); 
它给出一个错误,说
R.id.layoutRoot cannot be resolved.
这是什么意思?     
已邀请:
        验证在您的导入中是否有以下内容:
import com.myproject.R
并不是
import android.R
    
        检查
R.java file
(位于gen目录中),您会看到布局标识不属于
id
类,而是属于
layout
类。
    public static final class id {

    }
    public static final class layout {
        // Layouts are here...
    }
因此应为:
R.layout.layoutRoot
。     
        保存项目 从svn中排除bin,gen(如果使用的话) 提交,更新(如果使用svn) 清洁 尝试再次构建。如果不起作用: 删除gen,bin 保存 建立。     

要回复问题请先登录注册