我有一个问题在我的行动吧,我在试图建立一个搜索视图就可以了为了获得AA搜索栏扩展。
I have a problem on my Action bar, I tried to setup a search view on it in order to get a a search bar expandable.
这是沃金也只是一个事实,我不得不将所有的选项 ifRoom
其他菜单项,以便让搜索领域采取所有房间的时候,搜索图标点击。
This is woking well except the fact that I had to set all the other menu items with the option ifRoom
in order to let the search field take all the room when the search icon is clicked.
这部分还运作良好,除了一个事实,即过多的菜单项得到了推入菜单溢出,只有2个图标仍然是垂直屏幕上(包括搜索栏)。
This part also worked well except the fact that too many menu items got pushed into the menu overflow, only 2 icons remained on the vertical screen (including the search bar).
我做了另一项活动有5菜单项,另一项测试:
I did another test on another activity having 5 menu items:
在第一种情况下,我把所有的人都用安卓showAsAction =总是
在第二种情况下,我把所有的人都用`安卓showAsAction =ifRoom
In the first case, I set all of them with android:showAsAction="always"
In the second case, I set all of them with `android:showAsAction="ifRoom"
下面是结果:
案例1:
案例2:
为什么,如果我使用 ifRoom
,只显示2个图标,而实际上5可以随便填的地方?
Why if I use ifRoom
, only 2 icons are displayed while actually 5 could easily fill the place?
这一点,因为,我有我的搜索视图项旁边只提供一个菜单项...
Because of this, I have only one menu item available beside my search view item...
谢谢!
看起来像它的设计决定:
Looks like its a design decision:
杰克沃顿说:
当包含在操作栏中有一个有限的最多 基于设备的密度无关宽度操作项。该 操作项也不能覆盖的动作一半以上的宽度 吧。
When contained within the action bar there is a finite maximum of action items based on the device's density-independent width. The action items can also not cover more than half the width of the action bar.
从here.
上一篇:应用程序图标是不可见的动作条在Android的棒棒糖及以上棒棒糖、应用程序、图标、动作
下一篇:findFragmentById为SupportMapFragment在Android的工作室返回null工作室、SupportMapFragment、findFragmentById、null