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?
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.
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).
you sould replace drawerlayout in xml with below line
androidx.drawerlayout.widget.DrawerLayout
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With