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