Domanda

So I achieved setting a custom ActionView for a MenuItem inside my ActionBar, great!
Now, how do I keep the menuItem showing it's title (set in xml)?

This is important as I want users to read what that button is doing.
The customView serves as a regular menuItem and is always expanded.

I tried setting ContentDescription to the custom layout containing the same title, but no luck so far.
Thanks!

È stato utile?

Soluzione

Keep the content description, but in the constructor of your custom layout, setup Roman Nurik's CheatSheet. When you're using a custom MenuItem, it's up to you to make it accessible.

public ActionViewExample(Context context, AttributeSet attrs) {
    super(context, attrs);
    // Ensure the MenuItem is accessible
    CheatSheet.setup(this);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top