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?
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?
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
.
First step:
implementation "androidx.drawerlayout:drawerlayout:1.0.0"
add on top of your layout add:
<androidx.drawerlayout.widget.DrawerLayout>
Must end by closing tag:
</androidx.drawerlayout.widget.DrawerLayout>