onCreateOptionsMenu方法中,即使我做了其他類似的問題(onCreateOptionsMenu not being called on FragmentActivity when run on phone version 這Menu inside fragment not getting called像這樣的)所有的步驟不會被調用真)中的片段onCreateOptionsMenu沒有得到所謂的碎片
2 onCreate方法)我重寫onCreateOptionsMenu(菜單菜單,MenuInflater充氣)收作方法初探這樣
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.main, menu);
}
[3 )而且我dp實現onOptionsItemSelected(MenuItem項)]
WTH?
P.S.我正在使用android-support-v4.jar。
P.P.S @Philipp Jahoda,我在Fragment的託管活動中實現了onCreateOptionsMenu(...)。
謝謝你,這個解決方案正是我一直在尋找的!爲我節省了很多時間! –