menu icon not displaying on action bar
android, android-actionbar
Solution
I have come across this issue once myself. Try this:
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:title="@string/new_crime"
android:id="@+id/menu_item_new_crime"
android:icon="@drawable/ic_action_new"
android:showAsAction="always"
app:showAsAction="always"/>
</menu>
I don't know why it would be necessary to have both, but that fixed it for me for some reason.
Problem
``` Android Studio 0.5.8 ``` Hello, For some reason the icon never displays on the ActionBar, I have used a combination of ifRoom|withText but still doesn't display. I have also tried rotating in Landscape. I am using genymotion 4.4.2 ``` <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:title="@string/new_crime" android:id="@+id/menu_item_new_crime" android:icon="@drawable/ic_action_new" app:showAsAction="always"/> </menu> ``` I am inflating the menu in a fragment: ``` @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.fragment_crime_list, menu); } ``` Here is a screenshot: I have tried hardware nexus5 in portrait and landscape mode, but no icon. I have also tried using the following, but didn't work either: ``` android:icon="@android:drawable/ic_menu_add" ``` Many thanks for any suggestions,