[英]Intellij Idea Android development R.main
IntelliJ识别R.menu时遇到问题。 当我开始新项目时,我编写以下代码
package com.example.HelloWorld;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
import android.graphics.Color;
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView text = new TextView(this);
text.setTextColor(Color.RED);
text.setText("Alex ");
setContentView(text);
}
@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;
}
}
当我在eclipse中执行代码时,它工作正常,但是在IntelliJ中,它说它cannot resolve symbol 'menu'
有人有解决方案吗?
顺便说一下,我是IntelliJ环境的新手
基本上我的XML文件缺少资源中的菜单文件夹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.