Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DrawerLayout in AndroidX is Missing?

I use DrawerLayout and Hamburger menu in my App. I migrated my App to Androidx. Everything it seems right but DrawerLayout. It doesn't know DrawerLayout Class.

What I have to do?

like image 967
Fcoder Avatar asked Feb 25 '19 11:02

Fcoder


People also ask

What is Drawerlayout?

DrawerLayout acts as a top-level container for window content that allows for interactive "drawer" views to be pulled out from one or both vertical edges of the window.


3 Answers

AndroidX has its implementation of DrawerLayout.

Add implementation "androidx.drawerlayout:drawerlayout:1.0.0" to your module's dependencies (you can check Google's Maven repository catalog to confirm the available versions).

like image 174
CommonsWare Avatar answered Oct 18 '22 03:10

CommonsWare


you sould replace drawerlayout in xml with below line

androidx.drawerlayout.widget.DrawerLayout
like image 16
mmfarzaneh Avatar answered Oct 18 '22 03:10

mmfarzaneh


Add implementation "androidx.drawerlayout:drawerlayout:1.0.0" in your build.gradle file, then in the layout file you want to use drawer layout, change <androidx.core.widget.DrawerLayout tag to <androidx.drawerlayout.widget.DrawerLayout.

like image 3
Bukunmi Avatar answered Oct 18 '22 03:10

Bukunmi