0
我对IntelliJ识别R.menu有问题。当我开始新的项目,我的代码下面的代码Intellij Idea Android开发R.main
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我是新的方式
当你复制你的项目的IntelliJ,你也动main.xml中菜单布局来自/ res /菜单的文件?在Eclipse中,该文件通常会自动生成为main_menu.xml,但也有可能您已将其重命名。 – MarsAtomic 2013-05-08 03:45:48
是的,我只是通过文件夹,这是问题的感谢。这是我的愚蠢 – 2013-05-08 05:10:07