David Fortunato
David Fortunato

Reputation: 767

Android - ActionBarSherlock custom view in a MenuItem

I have a MenuItem list, and I wanna set the view of each MenuItem with a TextView and a RadioButton, but for default it just allow me set the view for Checkable (menuItem.setCheckable(true)). Exists any way to set this MenuItems on a RadioButton option or set an custom view, where I can custom the view for RadioButton option?

Upvotes: 0

Views: 1868

Answers (3)

David Fortunato
David Fortunato

Reputation: 767

Not for set an custom View, but to resolve my issue I did something like this:

subMenu.setGroupCheckable(groupId, true, true);

But only after the subMenu items are all added.

Upvotes: 1

Paul Burke
Paul Burke

Reputation: 25584

This question was asked a few days before yours: Custom views in actionbar

ActionProvider

Upvotes: 1

Martin Vandzura
Martin Vandzura

Reputation: 3127

try something similar like this on onCreateOptionsMenu:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    getSupportMenuInflater().inflate(R.menu.home, menu);

    MenuItem spin = menu.findItem(R.id.menu_spinner);
    spin.setActionView(channelsSpinner);

    return true;
}

Upvotes: 0

Related Questions