在我的片段中,我使用了两个菜单项,一个用于设置,另一个用于 gridview。当我单击任何一个未触发的菜单项时。并在 Onoptionitemselected 上登录但未在其中输入,请任何人帮助我,谢谢。 ..
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
getActivity().getMenuInflater().inflate(R.menu.settingmenu, menu);
getActivity().getMenuInflater().inflate(R.menu.menugridcalendar, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_setting:
Log.i(TAG,"InsdieGridmenu");
Intent intent = new Intent(getActivity(), SettingPage.class);
startActivity(intent);
break;
case R.id.gridmenuid:
Activity activity = getActivity();
if (activity instanceof ListItemClickListener) {
((ListItemClickListener)activity).OpenGridView();
}
break;
}
return true;
}