I made a simple app which when I open it I see the wallpaper and the 2 buttons.First button opens my gallery and the second one opens a Calculator app. Now I want to be able to slide from left to right and bring up the Navigation Drawer Activity.
I did this: right clicked on my app -> New -> Activity -> Navigation Drawer Activity. It created 2 java classes ( NavigationActivity
and NavigationDrawerFragment
), some layouts (activity_navigation
fragment_navigation
and fragment_navigation_drawer
). Anyway, what I don't know is how to make the navigation drawer show up, how do I link it to my activity_main
?
This is the activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:background="@drawable/digital_blue_wallp">
<TextView
android:text="@string/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff8fdff"
android:textSize="24sp"
android:id="@+id/welcome"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:background="@drawable/calcu"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/welcome"
android:layout_alignEnd="@+id/welcome"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button2"
android:background="@drawable/gallery"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>