行动吧 - ifRoom选项留下太多空间 [英] Action bar - ifRoom option leaving too much space

查看:117
本文介绍了行动吧 - ifRoom选项留下太多空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题在我的行动吧,我在试图建立一个搜索视图就可以了为了获得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:

  1. 在第一种情况下,我把所有的人都用安卓showAsAction =总是
  2. 在第二种情况下,我把所有的人都用`安卓showAsAction =ifRoom
  1. In the first case, I set all of them with android:showAsAction="always"
  2. 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.

从<一个href="https://groups.google.com/forum/?fromgroups#!topic/actionbarsherlock/9dfnA2hnNXg">here.

这篇关于行动吧 - ifRoom选项留下太多空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆