当我使用下面的行:布局无法找到
LinearLayout layoutRoot = (LinearLayout) findViewById (R.id.layoutRoot);
它提供了一个错误,说R.id.layoutRoot cannot be resolved.
这是什么意思?
当我使用下面的行:布局无法找到
LinearLayout layoutRoot = (LinearLayout) findViewById (R.id.layoutRoot);
它提供了一个错误,说R.id.layoutRoot cannot be resolved.
这是什么意思?
检查R.java file
(这是在根目录),你将看到的布局identifiants不属于id
类,但layout
类。
public static final class id {
}
public static final class layout {
// Layouts are here...
}
所以它应该是:R.layout.layoutRoot
。
我看了一下布局类,它的deosnt里面有layoutroot – Vaali 2011-06-15 04:55:33
你真的有一个叫layoutRoot.xml的布局吗? – 2011-06-15 08:07:01
验证在你的进口,你有这样的:
import com.myproject.R
,而不是
import android.R
保存项目(如果您使用它)
排除斌,创自SVN
提交,更新(如果你使用svn)
Clean
尝试再次构建。如果将不起作用:
删除根,仓
保存
生成。
你能告诉我们你得到的确切错误以及你在调用setContentView()的代码中的位置吗? – plowman 2011-06-14 17:07:15
查看内容= findViewById(R.layout.layoutRoot); 位图位图= content.getDrawingCache();这是代码,基本上我想拍摄屏幕并保存。 – Vaali 2011-06-15 04:52:52