Here is how my Clans Floating Action Menu structure looks like :
<com.github.clans.fab.FloatingActionMenu>
<com.github.clans.fab.FloatingActionButton/>
<com.github.clans.fab.FloatingActionButton/>
<com.github.clans.fab.FloatingActionButton/>
</com.github.clans.fab.FloatingActionMenu>
I want the Clans Floating Action Menu to be Collapsed when I click on one of Floating Action Button. I couldn't find anything on Internet.
Something Like (Random) :
floatingMenu.setState(FloatingActionMenu.STATE_COLLAPSED);
OR
floatingMenu.setState(FloatingActionMenu.STATE_EXPANDED);
And also this menu is on my app's home screen. So what happens is that when I press back button to close an activity and come back again to home, the menu is still open showing it's all action buttons.
So I want to close (Change state of FloatingActionMenu
) the menu
.
Note : If you want more clarification, comment below, I will attach a screenshot.
Did you try using .close()
to collapse the menu?
floatingMenu.close(true);
To collapse fab menu after clicking the FloatingActionButton, you can simply put this code inside the FloatingActionButton onClick event.
If you want to collapse fab menu after getting back to your main activity, you can start your activity with startActivityForResult
and then override onActivityResult
on your mainActivity and call close function inside it.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
floatingMenu.close(true);