
问题:更新支持库并使用工具栏后,溢出菜单按钮始终显示在带有和不带硬件菜单按钮的设备上
我需要的是:我希望溢出菜单按钮仅在设备没有硬件菜单按钮时显示
menu.xml文件
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/action_settings"
app:showAsAction="never"
android:title="@string/action_settings"/>
<item
android:id="@+id/import_data"
app:showAsAction="never"
android:title="@string/import_data"/>
Run Code Online (Sandbox Code Playgroud)
在活动中(ActionBarActivity)
@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;
}
Run Code Online (Sandbox Code Playgroud)
并在onCreate:setSupportActionBar(mToolbar);
帮助将不胜感激!