吴小龙同學

Fragment里更改Activity菜单

1
2
3
4
5
6
7
8
9
10
11
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//来指出fragment愿意添加item到选项菜单(否则, fragment将接收不到对 onCreateOptionsMenu()的调用)
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
getActivity().getMenuInflater().inflate(R.menu.menu_yuqing_search, menu);
}

联系我:吴小龙同学