android-floating-action-button icon indicating copy to clipboard operation
android-floating-action-button copied to clipboard

How to hide floating button when click on button

Open hitu opened this issue 9 years ago • 5 comments

i have open menu right after show all icon then click any icon after close all icon how to plz help me

hitu avatar Feb 02 '16 06:02 hitu

ok,actually you need to set your flaoting actiongbutton a listener,and when you click your button,FloatingActonsMenu.close().thats it ,good luck

JasonHezz avatar Feb 02 '16 08:02 JasonHezz

Thank you very much On Feb 2, 2016 1:44 PM, "JasonHezz" [email protected] wrote:

ok,actually you need to set your flaoting actiongbutton a listener,and when you click your button,FloatingActonsMenu.close().thats it ,good luck

— Reply to this email directly or view it on GitHub https://github.com/futuresimple/android-floating-action-button/issues/275#issuecomment-178438433 .

hitu avatar Feb 02 '16 08:02 hitu

Actually, you have to call toggle() function on your FloatingActionsMenu object (there is no close())

jwitos avatar Mar 24 '16 21:03 jwitos

Just add

@Override
public boolean dispatchTouchEvent(MotionEvent event){
        if(event.getAction() == MotionEvent.ACTION_DOWN){
            if(mFloatingMenu.isExpanded()){

                Rect outRect = new Rect();
                mFloatingMenu.getGlobalVisibleRect(outRect);

                if(!outRect.contains((int) event.getRawX(), (int) event.getRawY()))
                    mFloatingMenu.collapse();
            }
        }

        return super.dispatchTouchEvent(event);
    }

In order to close the menu when tapping anywhere on the screen.

Farasy avatar May 12 '16 08:05 Farasy

There are collapse() and collapseImmediately() now.

danielapsmaior avatar Jul 12 '16 20:07 danielapsmaior