code: public void setMenuView(int layoutResId) {
          mMenuContainer.removeAllViews();
          mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false);
          mMenuContainer.addView(mMenuView);
      }
docs: Set the menu view from a layout resource.
  
  @param layoutResId Resource ID to be inflated.