1

I have made an Activity with RelativeLayout and has been set well. Now as per the new requirement I have to add a navigation drawer to top left corner. How can I proceed further? Please anyone explain briefly.

Lamorak
  • 10,957
  • 9
  • 43
  • 57
Aalap Patel
  • 2,058
  • 2
  • 17
  • 31
  • [This](http://i.stack.imgur.com/cyNs6.png) is navigation bar. Are you sure you want to add that to the top left corner? I would suggest to read about android [design patterns](https://www.google.com/design/spec/patterns/app-structure.html) so you can describe your problems clearly :) – Lamorak Aug 18 '15 at 21:33
  • Yes sorry I misused the name, its navigation drawer I need to add. The hamburger icon on top left corner. In my relative layout I have text view, edit view and image view. Now if I replace the tag with tag I lose my edit view and I cant even drag and drop it. So i believe I have to use relative layout if I want to contain edit view in my activity. – Aalap Patel Aug 20 '15 at 00:53
  • possible duplicate of [Android Navigation Bar Top](http://stackoverflow.com/questions/2184778/android-navigation-bar-top) – Abhinav Singh Maurya Aug 20 '15 at 08:15

1 Answers1

0

I suggest you to use NavigationView to create your drawer. All you need to do is just to wrap your current RelativeLayout in the DrawerLayout and add the NavigationView

<android.support.v4.widget.DrawerLayout>
    <RelativeLayout>
        <android.support.v7.widget.Toolbar />
    </RelativeLayout>

    <android.support.design.widget.NavigationView
        android:layout_gravity="start"
        app:menu="@menu/drawer" />

</android.support.v4.widget.DrawerLayout>

Note you have to create your menu under res/menu/drawer.xml. You alsou should use AppCompatActivity and set your Toolbar with setSupportActionBar().

This is relatively good tutorial. This one is even more detailed.

Lamorak
  • 10,957
  • 9
  • 43
  • 57