Cannot resolve symbol DrawerLayout

匿名 (未验证) 提交于 2019-12-03 03:04:01

问题:

I'm trying to implement the Navigation Drawer as shown here: http://developer.android.com/training/implementing-navigation/nav-drawer.html#top

My code seems to be ok, and My minimum and target levels in my manifest match the example, but it's telling me it can't find the following three references

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

回答1:

May be you have found your answer but i think its for those who still wants to know. so, here's my answer,

For Android Studio:

First of all you need to add External Jar

  • In android studio go to File-> Project Structure -> Modules -> Dependencies -> + symbol -> Library Dependency.
  • Now search for support library. you will find something like this com.android.support:support-v13
  • Now, select Jar file named support-v13 (Whatever the version is) and click OK.

Now, you will see, no more errors like this.

For Eclipse:

Refer this link, Click here



回答2:

You need to make sure you are using the latest support library as the DrawerLayout and other items were added in the May 2013 release.

  • Added DrawerLayout for creating a Navigation Drawer that can be
    pulled in from the edge of a window.



回答3:

You need to reference the support library in your project dependencies. Import the jar package into your java build path using the Project/Properties/Java Build Path/Libraries tab and use the button 'Add External JARs....'

Now compile the project.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!