ActionBarSherlock 中的强制溢出菜单 [英] Force overflow menu in ActionBarSherlock
问题描述
我希望在 ICS 之前的设备 (2.3 - 2.1) 上使用 4.0+ 溢出菜单.我将 HoloEverywhere 与 ActionBarSherlock 结合使用.
I want the 4.0+ overflow menu to be used on pre ICS devices (2.3 - 2.1). I'm using HoloEverywhere with ActionBarSherlock.
我尝试了以下解决方案:
I tried the following solution:
ActionBarSherlock &HoloEverywhere - 强制溢出?
但它不起作用,因为 absForceOverflow
不存在.它是在最新版本中删除的还是什么?我已经检查了 ABS 和 HE 库项目的 R
文件,但该字段根本不存在.
but it does not work because absForceOverflow
does not exist. Was it removed in the newest version or something? I've checked the R
files of both ABS and HE library projects and the field is simply not there.
我的应用程序的主题设置为 @style/Holo.Theme.Sherlock.Light
,这是我试图继承并添加 absForceOverflow
参数的主题设置为 true
.
My app's theme is set to @style/Holo.Theme.Sherlock.Light
and that is the theme that i was trying to inherit from and add the absForceOverflow
parameter set to true
.
推荐答案
如果您使用的是 4.2.0 版,那么 .ForceOverflow
主题实际上已被删除.
If you are using Version 4.2.0, then .ForceOverflow
themes have in fact been removed.
来源: 4.2.0 版更新日志
更改日志摘录:
Add SearchView widget for standard search interaction (API 8+ only)
Fix: ShareActionProvider in the split action bar no longer fills the entire screen.
Fix: ShareActionProvider now does file I/O on a background thread.
Fix: Automatically correct ColorDrawable not respecting bounds when used as a stacked background.
Fix: Ensure fragments collection is present before dispatching events.
Fix: XML-defined onClick searches the correct context for the declared method.
Fix: Ensure action mode start/finish callbacks are invoked on the activity for the native action bar.
Fix: Allow tab callbacks to have a fragment transaction instance for any FragmentActivity.
Fix: Ensure CollapsibleActionView callbacks are dispatched in both native and compatbility action bars.
Fix: Remove .ForceOverflow themes. These never should have been included.
如果您绝对需要强制溢出,则需要下载较早版本的 ABS.您可以在此处根据其发布历史获取下载列表:http://actionbarsherlock.com/download.html
If you absolutely need to force Overflow, you will need to download an earlier version of ABS. You can get a list of download as per their release history here: http://actionbarsherlock.com/download.html
我个人仍然使用 ABS 版本 4.1.0,因为我目前不想在我的应用程序中进行辅助更改.我也在我的 theme.xml
中使用它:
I personally still use the ABS version 4.1.0 since I do not currently want to make ancillary changes in my app. I also use this in my theme.xml
:
<style name="MyTheme" parent="@style/Theme.Sherlock.ForceOverflow">
<item name="android:windowBackground">@color/background</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>
<style name="MyTheme.ForceOverflow">
<item name="absForceOverflow">true</item>
</style>
在为 manifest.xml
中的 Activity
应用主题时,我将其用作属性:"@style/Theme.SociallyYOU"代码>
And while applying a theme for an Activity
in the manifest.xml
, I use this as the attribute: "@style/Theme.SociallyYOU"
同样,如果您必须绝对强制溢出,您可能还想在此处的另一个问题中阅读 CommonsWare 对此的看法:https://stackoverflow.com/a/12872537/450534.
Again, if you must absolutely force overflow, you might also want to read CommonsWare's thought on the same in another question here: https://stackoverflow.com/a/12872537/450534.
注意:话虽如此,如果权衡不是很重要,最好使用最新版本.通过发布我如何强制溢出菜单,我既不建议您使用旧版本,也不建议您使用旧版本.它只是告诉您可能性.
NOTE: That being said, it is always better to use the latest version if the trade offs aren't to critical. By posting how I force the overflow menu, I am neither suggesting that you use an older version nor do I recommend that. It is merely informing you of the possibilities.
这篇关于ActionBarSherlock 中的强制溢出菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!