转载自http://blog.youkuaiyun.com/fuckluy/article/details/51471125
据说是v7支持包的一个BUG
解决方法: 将android:showAsAction="" 中的android 换掉,改成自定义的名字
方法如下 ,我使用的名字是ActionBar2
menu 布局文件下:
- <menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:ActionBar2="http://schemas.android.com/apk/res-auto">
使用 ActionBar2:showAsAction="ifRoom"
ActionBar2:showAsAction="ifRoom"
可以鼠标定位在 AcrionBar2 上直接alt+回车 连敲回车 ide会自动帮你补全
StackOverFlow上的解释。
This is because if you use the support AppCompat ActionBar library and ActionBarActivity you should create your menus in a different than the standard way of creating xml menus in ActioBarSherlock or the default ActionBar.