Clans / FloatingActionButton

Android Floating Action Button based on Material Design specification
Apache License 2.0
5.23k stars 1.13k forks source link

Not able to close floating action menu on click of outside #418

Closed mahidharguggilam closed 7 years ago

mahidharguggilam commented 7 years ago

How to add transparent black background and collapse fab menu on click of outside the fab menu

mahidharguggilam commented 7 years ago

My problem got solved In MainActivity

final FrameLayout mInterceptorFrame = (FrameLayout) findViewById(R.id.fl_interceptor); mInterceptorFrame.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Log.d(TAG, "onTouch " + ""); if (fabMain.isOpened()) { fabMain.close(true); return true; } return false; } });

In xml above floating action menu <FrameLayout android:id="@+id/fl_interceptor" android:descendantFocusability="blocksDescendants" android:layout_width="match_parent" android:layout_height="match_parent"/>