6

I am trying to implement ActionBarSherlock Side Menu Navigation Drawer in my app, but always getting :

DrawerLayout cannot be resolved to a type ActionBarDrawerToggle cannot be resolved to a type

My imports are:

import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
Sun
  • 6,768
  • 25
  • 76
  • 131
  • check out this link. Hope this will help you. http://stackoverflow.com/questions/17046443/android-import-drawerlayout-cannot-be-resolved – khubaib Sep 21 '13 at 10:24

2 Answers2

8

Import these from the support library

import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;

Check this

http://developer.android.com/tools/support-library/index.html

For more info on NaigationDrawer

http://developer.android.com/training/implementing-navigation/nav-drawer.html

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • 1
    I think it's relevant to add that you can use the v4 support library or you can simply copy the `android-support-v13.jar` support library into the /libs folder of your project. – Brandon Feb 04 '15 at 03:36
2

yeah I fully agree with @Raghunandan when we do work with Navigation Drawer, we need to use Latest support Library

And when we do work with ActionBar Sherlock Navigation Drawer, some imports we need to use in our program, see below:

import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.view.GravityCompat;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
Android
  • 1,529
  • 1
  • 12
  • 27