Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide fab on clicking anywhere in screen?

I am using Floating Action Button. I am using this library because I needed inbox style fab. The problem is, I can close the floating action menu only on clicking the bottom fab. What I need is, if I click anywhere else on the screen, then also the fab should collapse as happens in Inbox app. How to achieve this behavior? Is there any attributes in this library that I can use or do I need to implement that behavior on my own?

like image 929
Amit Tiwari Avatar asked Nov 17 '25 05:11

Amit Tiwari


1 Answers

The library has a method setClosedOnTouchOutside(boolean close) which you can use.

floatingActionMenu.setClosedOnTouchOutside(true);

But this will only be workable for floatingActionMenu's covered area. If you wanna close it by clicking anywhere in the layout then you should try this.

like image 65
Hemanth Avatar answered Nov 18 '25 19:11

Hemanth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!