Question

I am currently having an issue showing the option menu items on the actionbar. For some reason, the items only show on the overflow menu and this is true for post ICS devices as well. I am using the v7-appcompat library to support sdks from version 8 onwards.

In the main activity I have:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.wild_news, menu);
    return true;
}

My menu items are defined as follow:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      **xmlns:app="http://schemas.android.com/apk/res-auto"** >

  <item
    android:id="@+id/menu_refresh"
    android:icon="@drawable/ic_action_refresh"
    **app:showAsAction="always"**
    android:title="@string/menuTitle_refresh"/>
<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    **app:showAsAction="ifRoom"**
    android:title="@string/action_settings"/>

I also have a spinner in the actionbar with the following xml layout:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:minHeight="50dp"
       android:minWidth="140dp"
       android:layout_gravity="center_vertical"
       style="@style/ActionBarNavListTitle" />

I can't seem to get my head around it.

Was it helpful?

Solution

Great I found the issue to be related to a mismatch in the ActionBar style definition which I have resolved now:

<style name="ActionBarStyle"   parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top