首先重写oncreat方法,然后在oncreat方法中写一句话setHasOptionsMenu(true),如下图; 然后在onCreateOptionsMenu方法中手动代码添加: 转载于:https://blog.51cto.com/baiyueguang/1691042