3

I'm trying to use my own layout (R.layout.update_button) as an action bar menu item view.

The item declation is as follows:

<item
    android:id="@+id/menu_update"
    android:checkable="true"
    android:showAsAction="never"
    android:title="Title"/>

With the following code on the onCreateOptionsMenu(Menu menu) :

View updateView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.update_button, null);
update.setActionView(updateView);

The problem is that tihis only works when android:showAsAction is set to always. However when it is set to never, I only see the menu title ("Title") without any custom layout of mine.

Is there a way to show the custom layout even when showAsAction="never" ?

Simo L.
  • 321
  • 1
  • 3
  • 20
  • It sounds like you want to change the Overflow Menu's layout, check out: [Actionbar styled overflow menu items](http://stackoverflow.com/q/14859794/1267661) – Sam Mar 05 '13 at 16:03
  • I don't want to implement a list. It's just a single menu item to which I want to add a subtitle. I figured I could do that by making my own layout, but it doesn't work when it's in an overflow menu (only works whilst on the action bar) – Simo L. Mar 05 '13 at 21:49

0 Answers0