androidandroid-fragmentsbottom-sheetoverflow-menu

Opening bottom sheet when clicked on the overflow menu on a fragment


I am trying to implement behavior of opening bottom sheet when clicked on overflow menu. ex: expected behavior

I may do this on an activity using onMenuOpened as suggested here, But I want to do this on fragment.

How to achieve this behavior on a fragment?

I am using single activity pattern and navigation architecture component.


Solution

  • As discussed here opening bottom sheet when clicked on the overflow menu is bad UX.

    Why?

    Quoting from the post

    Because user have to reach the top of the screen to click the oveflow menu, then go back to the bottom to click desired action which is on the bottom sheet.

    -

    According to Fitt's Law - The time to acquire a target is a function of the distance to and size of the target. I agree that I think distance between the menu and the bottom sheet is substantial. This solution allows placing a lot options in one place.

    -

    it also doesn't match the user expectation since people are used to the overflow menu opening in a different manner.

    If you have a top action bar, use usual context menu. If you have a bottom action bar you may use bottom sheet.