Add a MenuItem to Menu at specific position or group programmatically
问题 I have a <android.support.design.widget.NavigationView app:menu="@menu/drawer" /> with the following menu items: <item android:id="@+id/main_item" android:icon="@drawable/ic_menu_main" android:title="@string/app_name"/> <group android:id="@+id/some_group" android:checkableBehavior="single"/> <item android:id="@+id/teams_item" android:icon="@drawable/ic_menu_teams" android:title="@string/teams"/> Now I want to add an item either to the some_group or just below it. I tried: MenuItem mi = menu