Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

navigation drawer vs navigation view which is best and what is the diffrence

i m using navigation drawer in old project but i got new project in this project they used navigation view so what is the difference beet been these two. which is the best for good for customize .

like image 753
androidking Avatar asked May 25 '17 09:05

androidking


People also ask

What is the navigation drawer?

The navigation drawer is a UI panel that shows your app's main navigation menu. The drawer appears when the user touches the drawer icon in the app bar or when the user swipes a finger from the left edge of the screen.

What is NavigationView in Android?

com.google.android.material.navigation.NavigationView. Represents a standard navigation menu for application. The menu contents can be populated by a menu resource file. NavigationView is typically placed inside a DrawerLayout .

What is drawer layout in Android?

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.


2 Answers

NavigationDrawer is a panel that displays the App’s Navigation option from the left edge of the screen.

Image for NavigationDrawer

and NavigationView is the builtin class/tag through which you tell the drawer what it looks like.

NavigationView consists of two main elements (these are optional):

  1. You have to tell the NavigationView if there is any header layout:

like this have header and menu both

  1. Menu in the NavigationView

If you don't want to use both then you don't need to use it. You can simply put your custom code (XML) inside DrawerLayout.

An easy example will help you to understand all the game.

like image 182
Atif Afridi Avatar answered Nov 15 '22 06:11

Atif Afridi


Navigation View is a widget provided by the android which you can use inside a Drawer. Navigation View makes it very easy to create a navigation menu inside your app.

Refer this for more:

https://developer.android.com/reference/android/support/design/widget/NavigationView.html

Navigation Drawer is nothing but a container where your navigation menu resides. Either you can use NavigationView for creating a highly customizable menu or you can simply use a listview to provide the menu items.

like image 27
schinj Avatar answered Nov 15 '22 05:11

schinj