The Wayback Machine - https://web.archive.org/web/20240623024512/https://www.geeksforgeeks.org/curve-navigation-drawer-in-android-using-arcnavigationview/
Open In App

Curve Navigation Drawer in Android using ArcNavigationView

Last Updated : 14 Oct, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The Navigation Drawer is a layout that can be seen in certain applications, that consists of some other activity shortcuts (Intents). This drawer generally can be seen at the left edge of the screen, which is by default. A Button to access the Navigation Drawer is by default provided at the action bar. 

Example of Google Drive Navigation Drawer.

UI changes can be applied to the Navigation Drawer. One such idea to change the Navigation Drawer UI is by making its outer edge an inner or an outer arc. This gives a creative and a richer look to the Drawer. Since some changes are limited by the Android Studio packages, such implementations require an outside library for making desired changes. This is done by implementing a known dependency (library) of an implementation that is desirable. Similarly, we as well implemented a dependency to fulfill our requirements.

Inside Arc Design on Navigation Drawer

To create an Inside Arc Design to the Navigation Drawer in an Android device, follow the following steps:

Step 1: Create a New Project

Create a Navigation Drawer Activity in Android Studio. To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. As you click finish, the project builds, might take a minute or two.

Step 2: Add the Dependency to the build.gradle of the app

Add the following dependency to the build.gradle (app) file. 

implementation ‘com.rom4ek:arcnavigationview:2.0.0’

Step 3: Working with the activity_main.xml file

When the setup is ready, go to the activity_main.xml file, which represents the UI of the project. Add the Script as shown below between the opening and closing Drawer Layout element.

XML




<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">
  
    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  
    <!--ArcNavigationView Element-->
    <com.rom4ek.arcnavigationview.ArcNavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"
        android:fitsSystemWindows="true"
        app:itemBackground="@android:color/white"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"
          
        app:arc_cropDirection="cropInside"
                                                      
        app:arc_width="96dp"/>
  
</androidx.drawerlayout.widget.DrawerLayout>


Output: Run on Emulator

Outside Arc Design on Navigation Drawer

Similarly to create an Outside Arc, make changes to the layout file. Changes made to activity_main.xml file:

XML




<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">
  
    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  
      <!--ArcNavigationView Element-->
    <com.rom4ek.arcnavigationview.ArcNavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"
        android:fitsSystemWindows="true"
        app:itemBackground="@android:color/white"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"
        app:arc_width="96dp"
            
        app:arc_cropDirection="cropOutside"/>
  
</androidx.drawerlayout.widget.DrawerLayout>


Output: Run on Emulator



Similar Reads

How to Align Navigation Drawer and its Elements towards the Left or Right of the Screen in Android?
The Navigation Drawer is a layout that can be seen in certain applications, that consists of some other activity shortcuts (Intents). This drawer generally can be seen at the left edge of the screen, which is by default. A Button to access the Navigation Drawer is by default provided at the action bar. So now the question is why is it is necessary
3 min read
Navigation Drawer in Android
The navigation drawer is the most common feature offered by android and the navigation drawer is a UI panel that shows your app's main navigation menu. It is also one of the important UI elements, which provides actions preferable to the users, for example changing user profile, changing settings of the application, etc. In this article, it has bee
5 min read
How to Change the Text Font of Side Navigation Drawer Items in Android?
The navigation drawer is the most common feature offered by android and the navigation drawer is a UI panel that shows your app’s main navigation menu. It is also one of the important UI elements, which provides actions preferable to the users like example changing user profile, changing settings of the application, etc. The user can view the navig
2 min read
How to Check Navigation Drawer Menu Items in Android?
Navigation Drawer or Slider Drawer is a UI component that is used in Mobile Applications and Websites to provide easy access to different features or parts of an app or website. Functioning of Navigation Drawer It is generally accessed by tapping on the hamburger menu icon (3 horizontal lines), present in the top-left or top-right corner of the scr
4 min read
Android Jetpack Compose - Implement Navigation Drawer
Jetpack Compose is a new UI toolkit from Google used to create native Android UI. It speeds up and simplifies UI development using less code, Kotlin APIs, and powerful tools. Prerequisites: Familiar with Kotlin and OOP Concepts as wellBasic understanding of Jetpack ComposeAndroid Studio Canary Version The navigation drawer is the most used feature
15 min read
How to Grouping Navigation Drawer Menu Items in Android?
Navigation Drawer or Slider Drawer is a UI pattern, used in Mobile Applications and Websites. It is used to provide easy access to different features or parts of an app or website. Functioning of Navigation Drawer It is usually accessed by tapping on the hamburger menu icon (3 horizontal lines), present in the top-left or top-right corner of the sc
4 min read
How to Add Icons in Navigation Drawer in Android?
Android navigation drawer is a user interface that shows the app's main navigation menu. It appears when the user touches the drawer icon in the app bar or when the user swipes their fingers or does some kind of action on the screen. It is not visible by default and it needs to open either by sliding from the left or clicking its icon in the Action
2 min read
How to Create Sliding Drawer For Displaying Image in Android?
A Sliding Drawer in Android is a mechanism of displaying hidden content on the screen when invoked and displayed by a handle generally a Button or an ImageView. Hidden content can be a view of any type. In General, hidden content can be of any ViewGroup. A sample photo of the Slider Drawer is shown below. It is very similar to a Navigation Drawer.
3 min read
Bottom Navigation Bar in Android Using Kotlin
We all have come across apps that have a Bottom Navigation Bar. Some popular examples include Instagram, WhatsApp, etc. In this article, we will learn about bottom navigation using Fragments. We will learn it by making a project in android studio. Here we will be using Kotlin as the language for development. To implement it in Java please refer to:
4 min read
How to Create Fragment Using Bottom Navigation in Social Media Android App?
This is the Part 2 of "Build a Social Media App in Android Studio" tutorial, and we are going to cover the following functionalities in this article: We are going to Create Bottom Navigation with 5 Fragments (Home, Users, AddBlog, ChatList, Profile).On HomeFragment we will be Showing all the added blogs.In the UsersFragment, we will be showing all
4 min read
Article Tags :
three90RightbarBannerImg