Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Use AwesomeBar Library in Android App?

  • Last Updated : 11 Jul, 2021

AwesomeBar is a library that animates and makes it really easy to integrate various features and functionalities in the app bar such as a navigation drawer, action button, and overflow menu. In this article, we will be implementing this library in an Android App using Java language. A sample GIF is given below to get an idea about what we are going to do in this article. 

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Add the library dependency 

Navigate to the Gradle Scripts > build.gradle(Module:app), add the library in the dependencies section, and sync the project.

dependencies {
    implementation 'com.github.florent37:awesomebar:1.0.3'

Step 3: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. 


<?xml version="1.0" encoding="utf-8"?>
            android:elevation="4dp" />
            <!-- Add main content here-->
                android:text="@string/app_name" />
    <!-- Layout for navigation drawer -->
        android:background="@android:color/white" />

Step 4: Working with the file

Go to the file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
import com.github.florent37.awesomebar.ActionItem;
import com.github.florent37.awesomebar.AwesomeBar;
public class MainActivity extends AppCompatActivity {
    AwesomeBar bar;
    DrawerLayout drawerLayout;
    protected void onCreate(Bundle savedInstanceState) {
        drawerLayout = findViewById(;
        bar = findViewById(;
        // adding action button in AwesomeBar with drawable and text
        bar.addAction(R.drawable.awsb_ic_edit_animated, "Add Post");
        // adding the OverFlowItem item in AwesomeBar
        bar.setActionItemClickListener(new AwesomeBar.ActionItemClickListener() {
            public void onActionItemClicked(int position, ActionItem actionItem) {
                // toast is shown when action item is pressed.
                Toast.makeText(getBaseContext(), actionItem.getText() + " clicked",Toast.LENGTH_SHORT).show();
        bar.setOverflowActionItemClickListener(new AwesomeBar.OverflowActionItemClickListener() {
            public void onOverflowActionItemClicked(int position, String item) {
                // toast is shown when an OverFlowAction item is pressed.
                Toast.makeText(getBaseContext(), item + " clicked", Toast.LENGTH_SHORT).show();
        bar.setOnMenuClickedListener(new View.OnClickListener() {
            public void onClick(View v) {
                // opens the navigation drawer from start
                Toast.makeText(getBaseContext(), "Opening Navigation  Drawer",Toast.LENGTH_SHORT).show();
        // setting true changes the clickable icon as "<"


GitHub Repository: AwesomeBar Library

My Personal Notes arrow_drop_up
Recommended Articles
Page :