I used the following library https://github.com/futuresimple/android-floating-action-button and everything works fine.
How do I close the menu automatically after clicking on one of the buttons on the same menu?
Asked
Active
Viewed 7,069 times
1
-
You can use a easy way to implement FAB_Menu without using any liberary check this answer: http://stackoverflow.com/a/40647621/4961126 – HAXM Nov 29 '16 at 12:12
2 Answers
8
Its open-source lib, You can read the source code and find that by your self.
FloatingActionsMenu.collapse(); // close the menu
FloatingActionsMenu.toggle(); // toggle the menu
FloatingActionsMenu.expand(); // open the mneu
In the Click listener
of the Menu Item
call .collapse()

JafarKhQ
- 8,676
- 3
- 35
- 45
0
FloatingActionMenu fAM = (FloatingActionMenu) findViewById(R.id.fAM_ID);
FloatingActionButton fAB1 = (FloatingActionButton)findViewById(R.id.fAB_ID);
floatingActionButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Action
Toast.makeText(MainActivity.this, "FAB Click", Toast.LENGTH_SHORT).show();
fAM.collapse();
}
});

Leroy Ortiz
- 1
- 4