可能重复:
ActionBarSherlock&HoloEverywhere -强制溢出?
我使用ActionbarSherLock库对预姜饼设备上显示的ActionBar ..
我想在动作条溢出菜单。我已经搜索了很多,我都知道,有硬件菜单按钮设备,则溢出菜单将不会显示..
而我也看了成该解决方案ActionbarSherlock样品演示,BT我仍然无法得到解决..
我已经创建了动作条的演示,当它没有菜单按钮,然后它会显示溢出菜单装置模仿,但如果设备有菜单按钮,然后溢出菜单将不会显示..
以下是我的配置: -
public class MainActivity extends SherlockActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater=getSupportMenuInflater();
inflater.inflate(R.menu.activity_main, menu);
// return true;
return super.onCreateOptionsMenu(menu);
}
}
清单: -
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="demo.menu.actionbar_using_lib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock"
>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
菜单配置: -
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/save"
android:title="@string/menu_save"
android:icon="@drawable/ic_action_search"
android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/setting"
android:title="@string/menu_settings"
android:icon="@drawable/ic_action_search"
android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/search"
android:title="@string/menu_search"
android:icon="@drawable/ic_action_search"
android:showAsAction="never"/>
<item android:id="@+id/refresh"
android:title="@string/menu_refersh"
android:icon="@drawable/ic_action_search"
android:showAsAction="never"/>
<item android:id="@+id/edit"
android:title="@string/menu_edit"
android:icon="@drawable/ic_action_search"
android:showAsAction="never"/>
<item android:id="@+id/delete"
android:title="@string/menu_delete"
android:icon="@drawable/ic_action_search"
android:showAsAction="never"/>
我想显示溢出menu..so PLZ推荐我..在此先感谢..