How to realize this custom popup menu with Material Design Android?

前端 未结 7 2033
夕颜
夕颜 2020-12-29 04:01

I want to realize a custom popup menu like Twitter in Android for example with item and picture but I don\'t know what\'s the component used for that.

In Material

7条回答
  •  有刺的猬
    2020-12-29 04:59

    Easier solution. Add this just before you .show() method.

    try {
      Field mFieldPopup=popupMenu.getClass().getDeclaredField("mPopup");
      mFieldPopup.setAccessible(true);
      MenuPopupHelper mPopup = (MenuPopupHelper) mFieldPopup.get(popupMenu);
      mPopup.setForceShowIcon(true);
    } catch (Exception e) {}
    

提交回复
热议问题