

Step 3: Now, you can see the directory structure, that shows the new file, “menu_main.xml” in “ menu” directory. Naming menu resource file to “menu_main.xml

Step 2: Give the file name, menu_main.xml -> click Ok, Step 1: To create menu file in menu folder, right click on “menu” directory -> “New” -> “ Menu resource file“, Now you can see a new Android Resource Directory “ menu” gets created,Īdding menu file in Menu Resource Directory Step 1: Open your project and right click on res, t hen click “ New”, then “ Android resource directory”,Īfter that change the resource type to “ menu” in the dropdown menu and then click “ OK”.

Here are the steps with which you can easily add a menu resource directory and file in Empty Activity in Android Studio, Adding Menu Resource Directory (res/menu)

It is the default option for Android developers, and as a Google offering, it integrates. According to the most recent top IDE list on the PYPL Index, Android Studio is the third most popular IDE in the world with a 9.87 percent share. Last, but not least we will create a list for the items that will be inside the navigation drawer. In the Explorer area on the left of Android Studio, right-click the res folder. It replaced the earlier Eclipse-based Android Development Tools (ADT) as the preferred IDE for the platform. Open res/layout/fragment_main.xml, go to the respective xml tab and paste the following: Then, we are going to make the xml for the fragment that is going to be replace the FrameLayout container view that we made above. Open res/layout/activity_main.xml, go to the respective xml tab and paste the following: We are going to make a simple layout xml for the AndroidNavDrawerActivity.java, that consists of two views, the FrameLayout that is going to be our container layout and the fragment that is going to be our navigation drawer. In this example, we are going to have a layout that uses a DrawerLayout with two child views: a FrameLayout to contain the main content (populated by a Fragment at runtime), and a ListView for the navigation drawer. Inside the DrawerLayout, we add one view that contains the main content for the screen and another view that contains the contents of the navigation drawer. To add a navigation drawer, we declare our user interface with a DrawerLayout object as the root view of the layout. A new Android Studio project has just been created.
