简体   繁体   中英

Adding click listener to FloatingActionsMenu

Does anyone know how to add a click listener to this FloatingActionsMenu ?

Mine is ignored

floatingActionsMenu.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                if(img.getVisibility()==View.VISIBLE) img.setVisibility(View.GONE);
                else img.setVisibility(View.VISIBLE);
            }
        });

To be clear: I want when I click on the main FAB for it to not only toggle, which it does now, but to also do some additional work for me.

Extend FloatingActionsMenu.java then add desired functionality to toggle:

@Override
public void toggle() {
    //do your job here
    super.toggle();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM