public void CollapseLevels(MotionEvent ev) { if (bsb.State == BottomSheetBehavior.StateExpanded) { Rect outRect = new Rect(); flSheet.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)ev.RawX, (int)ev.RawY)) { bsb.State = BottomSheetBehavior.StateCollapsed; } } }