Question

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!

Était-ce utile?

La solution

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);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top