Posts

Showing posts from May, 2014

Simple Navigation Drawer example in android

Image
Consider using simple NavigationView instead of this old Navigation drawer, which based on Material design and much simpler and very flexible than this Navigation drawer.

This NavigationDrawer example is developed by using appcompat library project in eclipse kepler.

Code:

MainActivity.java

import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.FragmentManager; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.support.v4.widget.DrawerLayout; public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the * navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in * {@link #restoreActionBar()}. */ private CharSequence mTitle; @Override protected void…