默认情况下不应该在操作栏下面吗?那么我做错了什么?
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
RES /菜单/ main.xml中
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.test.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
</menu>
解决方法:
根据Material Design specifications,溢出菜单应显示在操作栏的顶部:
A menu is a temporary sheet of paper that always overlaps the app bar, rather than behaving as an extension of the app bar.