Float menu

Updated at: 2023-07-21 07:48

AUFloatMenu provides a menu that contains icons and option lists.

Dependency

See Quick start.

API description

    /**
     * The constructor.
     *
     * @param context Activity context including the antui-build dependency.
     */
    public AUFloatMenu(Context context)
        /**
     * Align with the right by default.
     * @param view Display-based view.
     * @param popItems The list display model.
     */
    @Override
    public void showDrop(View view, ArrayList<MessagePopItem> popItems);

    /**
     * Align with the left.
     * @param view Display-based view.
     * @param popItems The list display model.
     */
    public void showAsDropDownLeft(View view, ArrayList<MessagePopItem> popItems);

    /**
     * Display in the center of the screen.
     * @param parent Display-based view.
     * @param title The title of the display list.
     * @param popItems The list display model.
     */
    public void showAsDropDownTitleCenter(View parent, String title, ArrayList<MessagePopItem> popItems);

    /**
     * Add the entry tapping event of the display list.
     * @param listener
     */
    public void setOnClickListener(AdapterView.OnItemClickListener listener)

Sample code

ArrayList<MessagePopItem> menuList = new ArrayList<MessagePopItem>();

    MessagePopItem item1 = new MessagePopItem();
    IconInfo info = new IconInfo();
    info.icon = getResources().getString(R.string.iconfont_add_user);
    item1.icon = info;
    item1.title = "Add contacts";
    menuList.add(item1);


    MessagePopItem item2 = new MessagePopItem();
    IconInfo info2 = new IconInfo();
    info2.icon = getResources().getString(R.string.iconfont_group_chat);
    item2.icon = info2;
    item2.title = "Group chat";
    menuList.add(item2);

    MessagePopItem item3 = new MessagePopItem();
    IconInfo info3 = new IconInfo();
    info3.icon = getResources().getString(R.string.iconfont_scan);
    item3.icon = info3;
    item3.title = "Scan";
    menuList.add(item3);

    MessagePopItem item4 = new MessagePopItem();
    IconInfo info4 = new IconInfo();
    info4.icon = getResources().getString(R.string.iconfont_collect_money);
    item4.icon = info4;
    item4.title = "Payment";
    menuList.add(item4);

    MessagePopItem item5 = new MessagePopItem();
    IconInfo info5 = new IconInfo();
    info5.icon = getResources().getString(R.string.iconfont_help);
    item5.icon = info5;
    item5.title = "Help";
    menuList.add(item5);

    final AUFloatMenu floatMenu = new AUFloatMenu(ScrollTitleBarActivity.this);
    floatMenu.showDrop(v, menuList);
    floatMenu.setOnClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(ScrollTitleBarActivity.this, String.valueOf(position), Toast.LENGTH_SHORT).show();
            floatMenu.hideDrop();
        }
    });
  • On this page (0)
  • Dependency
  • API description
  • Sample code
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare