无法显示溢出3点菜单 - SherlockActionBar [英] Unable to show the 3 dotted menu in overflow - SherlockActionBar

查看:137
本文介绍了无法显示溢出3点菜单 - SherlockActionBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜查了很多在互联网附近。我已经做了我该,但我依然无法显示3点菜单,因为我想要的。

I've searched alot around the internet. I've done what I had to, but still I'm unable to show the 3 dotted menu as I want.

下面是相关的code:

Here's the relevant code:

首先,我的清单分钟SDK设置为 9 和我targetSdk设置为 18

First, my manifest min sdk is set to 9 and my targetSdk is set to 18.

菜单的xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

 <item
    android:id="@+id/itemMainAlbum"
    android:showAsAction="ifRoom"
    android:title="Set as Main Album">
</item>
<item
    android:id="@+id/itemImport"
    android:showAsAction="ifRoom"
    android:title="Import">
</item>
<item
    android:id="@+id/itemSettings"
    android:showAsAction="ifRoom"
    android:title="Settings">
</item>

该活动的相应和code(扩展SherlockActivity):

The Activity's relevent code (extends SherlockActivity):

@Override
    public boolean onCreateOptionsMenu(Menu menu) {
       MenuInflater inflater = getSupportMenuInflater();
       inflater.inflate(R.menu.gallery_menu, menu);
       return super.onCreateOptionsMenu(menu);
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
       // Handle item selection
       switch (item.getItemId()) {
          case R.id.itemImport:
             startImportActivity();
             return true;
          case R.id.itemMainAlbum:
              setMainAlbum();
             return true;
          case R.id.itemSettings:
                 // do s.th.
              return true;
          default:
             return super.onOptionsItemSelected(item);
       }
    }

下面是我的行为是这样的:

Here's how my activity looks like:

在底部的菜单项显示,只有当我点击我的设备的菜单按钮。 3点菜单只是不显示,不管有多少菜单项,我想补充。

The menu item in the bottom is shown only when I click on my device's menu button. The 3 dotted menu is just never shown, no matter how many menu items I add.

推荐答案

如果你使用ActionBarSherlock,您可以使用这个小黑客。它完美的作品对我来说,并显示每一台设备我都测试了在menuoverflow。

If you use ActionBarSherlock, you can use this little hack. It works flawlessly for me and shows the menuoverflow on every device I have tested it on.

这篇关于无法显示溢出3点菜单 - SherlockActionBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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