doctorx0079 doctorx0079 - 1 year ago 95
Android Question

Menu item always goes in the overflow menu in Android

I have a menu icon for my ActionBar, but it always goes into the overflow menu no matter what I do. I want it to show up as an icon and not go into the overflow menu.

Here is my menu_daily_selfie.xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android=""
<item android:id="@+id/camera_button"

I'm using the appcompat library. What gives? Seems like this should work.

Here is my onCreateOptionsMenu:

public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(, menu);
return true;

Answer Source

My main activity extends ListActivity since it uses a ListView

Then you are not using appcompat-v7 properly. Either:

  • Switch to inheriting from AppCompatActivity, and manage your own ListView, or

  • Stop using appcompat-v7, and switch your menu resource to use android:showAsAction instead of app:showAsAction

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download