All Products
Search
Document Center

Float menu

Last Updated: May 25, 2021

AUFloatMenu provides a menu that contains icons and option lists.

Sample image

Dependency

See Quick start.

API description

 
  1. /**
  2. * The constructor.
  3. *
  4. * @param context Activity context including the antui-build dependency.
  5. */
  6. public AUFloatMenu(Context context)
  7. /**
  8. * Align with the right by default.
  9. * @param view Display-based view.
  10. * @param popItems The list display model.
  11. */
  12. @Override
  13. public void showDrop(View view, ArrayList<MessagePopItem> popItems);
  14. /**
  15. * Align with the left.
  16. * @param view Display-based view.
  17. * @param popItems The list display model.
  18. */
  19. public void showAsDropDownLeft(View view, ArrayList<MessagePopItem> popItems);
  20. /**
  21. * Display in the center of the screen.
  22. * @param parent Display-based view.
  23. * @param title The title of the display list.
  24. * @param popItems The list display model.
  25. */
  26. public void showAsDropDownTitleCenter(View parent, String title, ArrayList<MessagePopItem> popItems);
  27. /**
  28. * Add the entry tapping event of the display list.
  29. * @param listener
  30. */
  31. public void setOnClickListener(AdapterView.OnItemClickListener listener)

Sample code

 
  1. ArrayList<MessagePopItem> menuList = new ArrayList<MessagePopItem>();
  2. MessagePopItem item1 = new MessagePopItem();
  3. IconInfo info = new IconInfo();
  4. info.icon = getResources().getString(R.string.iconfont_add_user);
  5. item1.icon = info;
  6. item1.title = "Add contacts";
  7. menuList.add(item1);
  8. MessagePopItem item2 = new MessagePopItem();
  9. IconInfo info2 = new IconInfo();
  10. info2.icon = getResources().getString(R.string.iconfont_group_chat);
  11. item2.icon = info2;
  12. item2.title = "Group chat";
  13. menuList.add(item2);
  14. MessagePopItem item3 = new MessagePopItem();
  15. IconInfo info3 = new IconInfo();
  16. info3.icon = getResources().getString(R.string.iconfont_scan);
  17. item3.icon = info3;
  18. item3.title = "Scan";
  19. menuList.add(item3);
  20. MessagePopItem item4 = new MessagePopItem();
  21. IconInfo info4 = new IconInfo();
  22. info4.icon = getResources().getString(R.string.iconfont_collect_money);
  23. item4.icon = info4;
  24. item4.title = "Payment";
  25. menuList.add(item4);
  26. MessagePopItem item5 = new MessagePopItem();
  27. IconInfo info5 = new IconInfo();
  28. info5.icon = getResources().getString(R.string.iconfont_help);
  29. item5.icon = info5;
  30. item5.title = "Help";
  31. menuList.add(item5);
  32. final AUFloatMenu floatMenu = new AUFloatMenu(ScrollTitleBarActivity.this);
  33. floatMenu.showDrop(v, menuList);
  34. floatMenu.setOnClickListener(new AdapterView.OnItemClickListener() {
  35. @Override
  36. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  37. Toast.makeText(ScrollTitleBarActivity.this, String.valueOf(position), Toast.LENGTH_SHORT).show();
  38. floatMenu.hideDrop();
  39. }
  40. });