public static void parseXmlAndSetIconicsDrawables(@NonNull Context context,
                                                      int menuId,
                                                      @NonNull Menu menu,
                                                      boolean checkSubMenus) {
        try {
            XmlResourceParser parser = context.getResources().getXml(menuId);
            AttributeSet attrs = Xml.asAttributeSet(parser);
            parseMenu(context, attrs, parser, menu, checkSubMenus);
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
public static void parseXmlAndSetIconicsDrawables ( @ NonNull Context context , int menuId , @ NonNull Menu menu , boolean checkSubMenus ) { try { XmlResourceParser parser = context . getResources ( ) . getXml ( menuId ) ; AttributeSet attrs = Xml . asAttributeSet ( parser ) ; parseMenu ( context , attrs , parser , menu , checkSubMenus ) ; } catch ( XmlPullParserException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Uses the styleable tags to get the iconics data of menu items. Useful for set icons into
{@code BottomNavigationView}
<p>
By default, menus don't show icons for sub menus, but this can be enabled via reflection
So use this function if you want that sub menu icons are checked as well