Short version:
I'm looking for a BottomAppBar's equivalent of onPreprareOptionMenu(), so that I may dynamically configure (enable/disable) submenu items.
Full version:
I have a layout.xml:
<androidx.coordinatorlayout.widget.CoordinatorLayout>
...
<com.google.android.material.bottomappbar.BottomAppBar
...
app:menu="@menu/menu"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
and menu.xml:
<menu>
<item android:id="@+id/action"
...
>
<menu>
<item android:id="@+id/action_1"
...
/>
<item android:id="@+id/action_2"
...
/>
</menu>
</item>
</menu>
Now, I would like to dynamically enable or disable submenus id/action_1 or id/action_2. Any ideas?
Once you have a reference to BottomAppBar (which can be obtained via findViewById() or Data Binding, for instance), the submenu items can be accesess: