默认情况下不应该在操作栏下面吗?那么我做错了什么?
@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中
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.test.MainActivity" >
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
解决方法:
A menu is a temporary sheet of paper that always overlaps the app bar, rather than behaving as an extension of the app bar.
这是Android Lollipop应用程序以及使用AppCompat v7支持库的任何应用程序的默认行为.
标签:android,java,android-actionbar
来源: https://codeday.me/bug/20190925/1816149.html