I have an applications that's running just fine but I've duplicated the drawerlayout on every view page and also had to set all the click events and listeners in all the associated activities for each view so all the buttons work. This is a nightmare when adding new views because I have to set it all up again on those pages as well.
My application already uses fragments in other areas but I'm only half familiar with them so far and I can't figure out how to apply fragments to the drawerlayout. I haven't been able to find any examples of this in practice, does anyone know how to have just one drawer for all views?
Here is one of the views in which I duplicated it already:
My application already uses fragments in other areas but I'm only half familiar with them so far and I can't figure out how to apply fragments to the drawerlayout. I haven't been able to find any examples of this in practice, does anyone know how to have just one drawer for all views?
Here is one of the views in which I duplicated it already:
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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"
tools:context= ".Dashboard" >
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.android.basicsyncadapter.QuotesActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<com.miguelcatalan.materialsearchview.MaterialSearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_quotes" />
<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
android:id="@+id/myBottomNavigation_ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_dashboard"
app:menu="@menu/activity_dashboard_drawer" />
</android.support.v4.widget.DrawerLayout>