有没有一个标准的方式来增加操作栏项目之间的分隔中的Andr​​oid 3.0? [英] Is there a standard way to add dividers between action bar items in Android 3.0?

查看:132
本文介绍了有没有一个标准的方式来增加操作栏项目之间的分隔中的Andr​​oid 3.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小问题想定制我的应用程序的操作栏的外观。我希望能够有像素宽的分隔您在许多本机应用程序(如Gmail,Google日历)的见组动作栏项目。我找到了一种方法通过增加一个菜单项,并设置了机器人:actionLayout做这个属性为分频器的自定义布局:

I have a slight problem trying to customise the look of the action bar in my app. I want to be able to have the pixel wide dividers to group action bar items that you see in many of the native apps (e.g. Gmail, Calendar). I found a way to do this by adding a menu item and setting the 'android:actionLayout' attribute to a custom layout for the divider:

<View
  android:background="@color/LightGray"
  android:layout_marginTop="5dip"
  android:layout_marginBottom="5dip"
  android:layout_width="1dip"
  android:layout_height="fill_parent" />

这工作得很好,但问题是它算作一个菜单项和操作栏,似乎菜单项的数量限制为4 - 任何人将被推入到溢出菜单

This works nicely, but the issue is it counts as a menu item and the action bar seems to limit the number of menu items to 4 - any others get pushed into the overflow menu.

所以我猜我问的是是否有一个标准的方式来增加项目的分隔,而不必使用菜单项以自定义视图,并在某种程度上,这并不对极限动作栏项目数?

So I guess what I'm asking is whether there is a standard way to add item dividers without having to use a menu item with a custom view, and in a way that doesn't count towards the limit for action bar items?

在此先感谢!

推荐答案

我不会试图武力分隔成系统不会自动添加它们,因为它将使该平台您的应用程序不一致的地方。默认行为是:

I wouldn't try and force dividers into places that the system does not add them automatically as it will make your app inconsistent with the platform. The default behavior is:

  • 溢出和其他人之间的分隔。
  • 文本和其他项目哪里会歧义哪个项目文本所属的分频器。

这篇关于有没有一个标准的方式来增加操作栏项目之间的分隔中的Andr​​oid 3.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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