Search code examples
androidbottomnavigationviewmaterial-components

Bottom Navigation Drawer


I am having trouble implementing bottom drawer as seen in example from:

https://material.io/design/components/navigation-drawer.html#bottom-drawer

I have first done something similar to:

https://material.io/develop/android/components/navigation-view/

But I don't know how should I anchor it to the bottom. I have tried using different combinations of layout_gravity but either it crashed at the beginning or when trying to open it using:

drawer_layout.openDrawer(Gravity.START) 

I am a little bit stuck so any help will be appreciated!


Solution

  • Thanks to @Mike.M I have came up with solution. I have used BottomSheetDialogFragment to show from menu:

    This is just a sample kotlin class

    class BottomDialogFragment : BottomSheetDialogFragment() {
    
        override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
            return inflater.inflate(R.layout.f_bottomsheet, container, false)
        }
    
        companion object {
            fun newInstance(): MainBottomDialogFragment {
                return MainBottomDialogFragment()
            }
        }
    }
    

    And I can style it as I see fit in xml file - so another plus that it's easy and very flexible.