【发布时间】:2013-09-03 20:42:59
【问题描述】:
我在 Eclipse 上创建了一个新的应用程序项目,但它立即在 MainActivity.class 的代码上给出错误。 错误在 setcontentview 的 R. 上
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
但如果我导入 android.R,那么它会在单词 activity_main(它不像布局那样识别它)和单词 main 上给出错误。 我能做些什么?奇怪的是错误出现在刚刚创建的应用程序上。
【问题讨论】:
-
你能显示该文件中的所有代码吗?我想是因为你的包裹。
-
我解决了创建新工作区的问题。