How can I add item to the top ActionBar?

Viewed 18132

I would like to add new icon to the top action bar, bet instead of adding to the top, the icon appear on the bottom of the screen. How can I add 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;
}
4 Answers
Related