在ActionBarSherlock力溢出菜单菜单、ActionBarSherlock

2023-09-11 12:28:55 作者:狗比人忠

我想上pre 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.

我尝试以下解决方案:

ActionBarSherlock &放大器; HoloEverywhere - 强制溢出

,但它不工作,因为 absForceOverflow 不存在。当时它在最新的版本或东西去掉?我检查了两个ABS和HE库项目的研究文件和现场根本不存在。

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.

我的应用程序的主题设置为 @风格/ Holo.Theme.Sherlock.Light ,那就是我试图要继承并添加 absForceOverflow 参数设置为

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 ,我用这个作为属性: @风格/ Theme.SociallyYOU

And while applying a theme for an Activity in the manifest.xml, I use this as the attribute: "@style/Theme.SociallyYOU"

同样,如果你必须绝对强制溢出,你可能还需要阅读CommonsWare的思想在这里另一个问题是相同的:http://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: http://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.

 
精彩推荐
图片推荐