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!

有帮助吗?

解决方案

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);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top