Android动作栏compat
有可能吗?在较旧的设备(3.0之前版本)上,只有在按下菜单键时才显示不适合操作栏的项目,我希望这些项目在操作栏的溢出菜单中分组.
android overflow android-4.0-ice-cream-sandwich actionbarsherlock android-actionbar
我在我的应用程序中使用appcompat.我希望菜单项显示在操作栏上或至少溢出(3个点)以在没有空间时显示它们.操作栏上有很多空间,但它们仍然没有显示出来.菜单流从底部升起,仅在按下菜单按钮时也是如此.
menu_activity.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/menu_lang"
android:showAsAction="always"
android:title="@string/menu_lang"
android:icon="@android:drawable/ic_input_lang"/>
</menu>
Run Code Online (Sandbox Code Playgroud)
活动:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_activity, menu);
return true;
}
Run Code Online (Sandbox Code Playgroud)
这篇文章说,当硬件菜单按钮存在时,它不起作用.但其他应用程序可以在同一设备上显示项目.所以,这个答案似乎是不正确的.有人可以帮忙吗?
