I have looked around many times already at different posts and none of them have solved this problem for me. My XML defined menu item always show up in the the overflow, and it show up twice. Here is the XML file:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/add_Playlist"
android:icon="@android:drawable/ic_menu_add"
app:showAsAction="ifRoom|withText"
android:title="@string/addPlaylist" />
</menu>
I'm inflating the menu on top of my toolbar in the activity file:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setActionBar((android.widget.Toolbar) findViewById(R.id.toolbar));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
And yet the menu items show up in the overflow. In Android Studio's render view the menu looks correct.
If you want me to attach a snapshot I will. I'm running the app on an emulator with API 23 (For now). I don't know if I should include any other files but tell me if you want them. Thanks in advance!
[EDIT] Here is a screenshot of the toolbar: https://gyazo.com/2743b74a8aee07035b8398f1b41002c4
Here is my styles.xml:
<resources
xmlns="http://schemas.android.com/apk/res-auto">
<color name="card_title_text">#111111</color>
<color name="card_desc_text">#aaaaaa</color>
<color name="action_bar_text">#ffffff</color>
<!-- Base application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionMenuTextColor">@color/action_bar_text</item>
<item name="android:navigationBarColor">@color/black</item>
<item name="android:colorForeground">@color/foreground_material_light</item>
<item name="android:colorBackground">@color/background_material_light</item>
<item name="android:statusBarColor">@color/statusBarColor</item>
<item name="android:windowBackground">@color/windowBackground</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="actionMenuTextColor">@color/action_bar_text</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
I also tried setting app:showAsAction="always" but it didn't work. No visible change.