public class MainActivity extends Activity {
@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;
}
}
这是我目前得到的错误:
The method inflate(int, android.view.Menu) in the type MenuInflater is not applicable for the arguments (int, com.example.thebasicstweekz.Menu)
The method onCreateOptionsMenu(Menu) of type MainActivity must override or implement a supertype method
答案 0 :(得分:0)
尝试使用getSupportMenuInflater
getSupportMenuInflater().inflate(R.menu.main, menu);
而不是
getMenuInflater().inflate(R.menu.main, menu);
导入菜单 - 应为android.view.Menu
答案 1 :(得分:0)
您是否尝试过DDMS视角?
你试过Window>查看“Android”或“LogCat”的搜索?
由于