Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. my navigation drawer doesnot work in android version less than 4.1.

my navigation drawer doesnot work in android version less than 4.1.

Scheduled Pinned Locked Moved Android
cssandroiddata-structuresannouncement
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yuvraaz Poudel
    wrote on last edited by
    #1

    public class SwappingClassDashboard extends Activity { DrawerLayout dl; ListView list; ActionBarDrawerToggle toogle; CharSequence title, dtitle; String[] acfservice; MainActivity mainactivity; @Override protected void onCreate(Bundle savedInstanceState) { ActionBar actionbar = getActionBar(); ColorDrawable colorDrawable = new ColorDrawable( Color.parseColor("#0067b4")); actionbar.setBackgroundDrawable(colorDrawable); super.onCreate(savedInstanceState); setContentView(R.layout.swapping_layout); // initializing the value for username and passord field for login mainactivity = new MainActivity(); // end of variable assignment title = dtitle = getTitle(); acfservice = getResources().getStringArray(R.array.acf_array); dl = (DrawerLayout) findViewById(R.id.drawer_layout); list = (ListView) findViewById(R.id.listview); // set a custom shadow that overlays the main content when the drawer // opens dl.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); // set up the drawer's list view with items and click listener list.setAdapter(new ArrayAdapter(this, R.layout.list_drawer, acfservice)); list.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer ActionBar actionbar1 = getActionBar(); actionbar1.setIcon(R.drawable.acf); actionbar1.setTitle("ACFNepal"); actionbar1.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon toogle = new ActionBarDrawerToggle(this, /* host Activity */ dl, /* DrawerLayout object */ R.drawable.click, /* nav drawer image to replace 'Up' caret */ R.string.onopen, /* "open drawer" description for accessibility */ R.string.onclose /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(title); invalidateOptionsMenu(); // creates call to // onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(dtitle); invalidateOptionsMenu(); // creates call to // onPrepareOptionsMenu() } }; dl.setDrawerListener(toogle); if (savedInstanceState == null) { selectItem(0); } }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups