如何在不截断显示Android的动作条的标题出现 [英] How to display android actionbar title without truncation occurring

查看:183
本文介绍了如何在不截断显示Android的动作条的标题出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当长的标题(例如我的长标题应用程序)的应用程序。我使用的是动作条,发现应用程序的标题不断被截断(例如:我的长标题A ...)。出现这种情况,即使2动作栏项目(包括标记为ifRoom)显示。

I have an app with a reasonably long title (e.g. My Long Title App). I am using an ActionBar and noticed the app title keeps being truncated (e.g. My Long Title A...). This happens even though 2 action bar items (both marked as 'ifRoom') are displayed.

有谁知道是否有一种方法,以确保活动名称宽度优先于ifRoom操作栏项目(即确保我的标题显示完全,用行动物品栏移动到下拉菜单中,如果需要更多的空间) ?

Does anyone know if there is a way to ensure the Activity Title width takes priority over 'ifRoom' action bar items (i.e. ensure my title displays in full, with action bar items moving to the dropdown menu if more room is needed)?

感谢的人。

推荐答案

不幸的是没有办法的操作栏标题prevent截断。你这样做,不过,有一些选项来释放一些空间在你的动作条。你可以:

Unfortunately there is not a way to prevent truncation of the action bar title. You do, however, have some options to free up some room in your action bar.. You can either:

  1. 在强制操作项目到溢出菜单。如果您使用的是最新的ActionBarSherlock(4.2.0),这是更难做到这一点。看到这个使用4.2.0时,回答的解决方法。如果你觉得最新的版本,你可以使用ABS 4.1.0。在4.1.0,您只需设置你的活动主题为 @风格/ Theme.Sherlock.ForceOverflow 。请注意,迫使溢出菜单是不推荐,因为它提供了跨应用程序不一致的导航。
  2. 您可以使用拆分操作栏并强制行动项目进入底部操作栏。看看CommonsWare的回答这里。有关拆分操作栏的信息,请参阅这里
  1. Force your action items into the overflow menu. If you are using the latest ActionBarSherlock(4.2.0) it is much harder to do this. See this answer for a workaround when using 4.2.0. If you feel the newest version isn't required, you can use ABS 4.1.0. On 4.1.0, you just set your activity theme to @style/Theme.Sherlock.ForceOverflow. Please note that forcing the overflow menu is not recommended as it provides inconsistent navigation across apps.
  2. You can use a split action bar and force the action items into the bottom action bar. Have a look at CommonsWare's answer here. For information on the split action bar, see here.

这篇关于如何在不截断显示Android的动作条的标题出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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