我对 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 环境的新手