How to access ActionBar MenuItem in android?

DenisZakharov.2605DenisZakharov.2605 USMember
edited February 2016 in Xamarin.Forms

Hello,

I have a page with toolbar items in it.

<ContentPage.ToolbarItems>
    <ToolbarItem Text="123”/> <!--action_myitem-->
</ContentPage.ToolbarItems>

How to access ActionBar MenuItem that rendered for <ToolbarItem Text="123”/> in Android?
The native analog of needed functionality is

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

        // Get the notifications MenuItem and 
        // its LayerDrawable (layer-list)
        MenuItem item = menu.findItem(R.id.action_myitem);
        LayerDrawable icon = (LayerDrawable) item.getIcon();

        return true;
    }

Thank you.

Best Answer

Answers

  • rraallvvrraallvv Member ✭✭

    @DenisZakharov.2605 is there a way to be notified from the custom renderer each time OnPrepareOptionsMenu is called? What I have in mind is to add a badge to one of the menu items without having add a customized native menu layout in xml

Sign In or Register to comment.