@Override protected void onDetachedFromWindow() { if (mPopupMenu != null) { mPopupMenu.dismiss(); } super.onDetachedFromWindow(); }
public void show() { if (mPopupMenu != null) { mPopupMenu.dismiss(); } removeAllViews(); for (final MenuItem item : ((MenuImpl) mMenu).getMenuItems()) { if (item.isVisible()) { addMenuButton(item); } } invalidate(); }