android-floating-action-button
android-floating-action-button copied to clipboard
How to hide floating button when click on button
i have open menu right after show all icon then click any icon after close all icon how to plz help me
ok,actually you need to set your flaoting actiongbutton a listener,and when you click your button,FloatingActonsMenu.close().thats it ,good luck
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 .
Actually, you have to call toggle()
function on your FloatingActionsMenu object (there is no close()
)
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.
There are collapse()
and collapseImmediately()
now.