Sun
Sun

Reputation: 6888

DrawerLayout and ActionBarDrawerToggle cannot be resolved to a type

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;

Upvotes: 6

Views: 14702

Answers (2)

Android
Android

Reputation: 1609

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;

Upvotes: 2

Raghunandan
Raghunandan

Reputation: 133560

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

Upvotes: 8

Related Questions