i cannot seem to make the icons appear on the action bar on top of the activity at my project, i am using the right namespace with the right extend and everything should be running be smoothly, this is the xml for the menu items and i have added the line "xmlns:app="http://schemas.android.com/apk/res-auto"" and it still doesn't work
<?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:id="@+id/action_search"
android:icon="@mipmap/ic_search_white_24dp"
android:title="Search"
android:showAsAction="ifRoom"/>
<item android:id="@+id/action_add"
android:icon="@mipmap/ic_add_white_48dp"
android:title="Add"
android:showAsAction="ifRoom"/>
this is the java code for the menu inflater
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_actions, menu);
return super.onCreateOptionsMenu(menu);
}
ifRoom
is a bit finicky, if you want the icons to show try switching theshowAsAction
value toalways
– Chris Stillwell