android studio <item/>标签下不能使用showAsAction属性的原因

来源:互联网 发布:ubuntu 查看命令参数 编辑:程序博客网 时间:2024/05/17 07:36


转载自http://blog.csdn.net/fuckluy/article/details/51471125


据说是v7支持包的一个BUG


解决方法:         将android:showAsAction=""  中的android 换掉,改成自定义的名字    

                           方法如下 ,我使用的名字是ActionBar2

                           menu 布局文件下:

  1. <menu xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     xmlns:ActionBar2="http://schemas.android.com/apk/res-auto">  

      使用 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.

0 0