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

前端 未结 7 2044
夕颜
夕颜 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 05:02
      try {
                        java.lang.reflect.Field[] fields = popup.getClass().getDeclaredFields();
                        for (java.lang.reflect.Field field : fields) {
                            if ("mPopup".equals(field.getName())) {
                                field.setAccessible(true);
                                Object menuPopupHelper = field.get(popup);
                                Class<?> classPopupHelper = Class
                                        .forName(menuPopupHelper.getClass().getName());
                                Method setForceIcons = classPopupHelper
                                        .getMethod("setForceShowIcon", boolean.class);
                                setForceIcons.invoke(menuPopupHelper, true);
                                break;
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
    
    0 讨论(0)
提交回复
热议问题