Learn how to use the Material Design Support Library's NavigationView to navigate between multiple fragments.
Create new empty repo on GitHub
Run the following commands to base the new repo on the existing android-navigationview-material-design repo.
cd ~/repos/android
git clone git@github.com:exponential-io/android-navigationview-material-design.git android-navigation-material-design
cd android-navigation-material-design
# Change the git@github URL below to match your repo
git remote set-url origin git@github.com:exponential-io/android-navigation-material-design.git
git push origin master
# View remote urls
git remote -v- Open the new project in Android Studio.
- Right-click on app in the Project pane, click Open Module Settings.
- In the Project Structure dialog box, click the Flavors tab.
- Change the Application Id to
mdnavigation. - Click OK.
- Change the Application Id to
- Open
build.gradle:- Notice how
applicationIdhas been changed tomdnavigation.
- Notice how
- Open the
AndroidManifest.xml:- Change the package to
mdnavigation.
- Change the package to
- Refactor the
io.exponential.mdnavigationviewpackage toio.exponential.mdnavigation. - Open `MainActivity.java:
- Change the package to
package io.exponential.mdnavigation;.
- Change the package to
- Open `MainFragment.java:
- Change the package to
package io.exponential.mdnavigation;.
- Change the package to
- Open
strings.xml:- Change
app_nametoMaterial Design Navigation.
- Change
- Select Build, click Clean.
- Select Build, click Rebuild Project.
- Commit your changes to git.
- Select File, click Invalidate Caches / Restart....
You can now start to follow the steps to implement navigation via the NavigationDrawer through the git commit log. Begin with the commits that are prefixed with nav:.