ActionbarSherlock不包括"溢出"操作栏的部分(在Android 2.1)不包括、操作、部分、ActionbarSherlock

2023-09-05 07:09:33 作者:傻逼年年有,今年特别多

我开发的 Android 2.1的API 7 应用。为了实现行动起来吧,我用的 ActionbarSherlock 库。

I am developing Android 2.1 API 7 app. To implement action bar, I am using ActionbarSherlock library.

一切顺利的福尔摩斯库,我可以在我的项目有以下code实现它的行动吧。

Everything goes fine with the sherlock library, I can implement action bar with it in my project with the following code.

RES /菜单/ action_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:id="@+id/new_payment_1"
          android:title="@string/new_payment"       
          />    

    <item 
          android:id="@+id/label_1"
          android:icon="@drawable/ic_launcher"
          android:showAsAction="always"/>

    <item 
          android:id="@+id/label_2"
          android:title="text2"
          android:showAsAction="always"/>

    <!-- overflow section of action bar -->
    <item android:title="title2"/>

    <item android:title="title3"/>

    <item android:title="title4"/>

</menu>

在我的活动类:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.action_menu, menu);
   return true;
}

我的动作条成功地与上述code。一点问题都没有在Android 3.2平台。

I got action bar successfully with above code. No problem at all on Android 3.2 platform.

但问题是如果我跑我在的Andr​​oid 2.1 平台的应用程序,操作栏的没有溢出栏目上的操作栏。 为什么??? 任何人都已经在使用遇到了同样的问题,福尔摩斯旧Android平台的库?

BUT the problem is if I run my app on Android 2.1 platform, the action bar has no overflow section on the Action Bar. Why??? Anyone has experienced the same problem when using Sherlock library on old Android platform??

(PS的操作栏中的溢出节是操作栏最右侧的一部分隐藏像一个弹出菜单中的某些项目。的这里更多信息)

(P.S. "overflow section" of action bar is the right-most part of action bar which hides some items like a popup menu. More info here )

推荐答案

它采用了原生的选项菜单上溢,只是作为一个冰淇淋三明治的手机就应该一个具有硬件菜单键进行。

It uses the native options menu as overflow, just as an Ice Cream Sandwich phone would should one be made with a hardware menu key.

强制溢出操作项是关于pre-4.0设备的操作栏将是ActionBarSherlock第4版的功能。

Forcing an overflow action item to be on the action bar on pre-4.0 devices will be a feature of version 4 of ActionBarSherlock.