I would like to add a new icon to the top action bar, instead of adding to the top, the icon appears at the bottom of the screen. How to add an item to the top ActionBar?
XML:
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/preferences" android:icon="@drawable/preferences" android:title="Preferences" android:showAsAction="always|withText"/> <item android:id="@+id/help" android:title="Help" android:icon="@drawable/ic_action_search" /> </menu>
Java:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_ygo_main, menu); return true; }
source share