問題描述
我正在嘗試從 Android 導入使用新的導航抽屜"所需的類http://developer.android.com/design/patterns/navigation-drawer.html#ImpactOnNav
I'm trying to import the classes required to use the new "Navigation Drawer" from Android http://developer.android.com/design/patterns/navigation-drawer.html#ImpactOnNav
抽屜布局:http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
ActionBarDrawerToggle:http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html
ActionBarDrawerToggle: http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html
無法解析導入android.support.v4.widget.DrawerLayout無法解析導入android.support.v4.app.ActionBarDrawerToggle
The import android.support.v4.widget.DrawerLayout cannot be resolved The import android.support.v4.app.ActionBarDrawerToggle cannot be resolved
我已將庫更新到最新版本,但仍然無法識別這些類.
I have updated the libraries to the latest version but still these classes are not recognized.
推薦答案
如何更新庫中的 JAR?
How do I update the JARs in libs?
我通常通過復制文件來做到這一點.您將在 $ANDROID_SDK/extras/android/support
中找到 JAR,其中 $ANDROID_SDK
是安裝 Android SDK 的位置.
I usually do it by copying the file. You will find the JARs inside $ANDROID_SDK/extras/android/support
, where $ANDROID_SDK
is wherever your Android SDK is installed.
如果您使用 Eclipse,如果您在文件系統(tǒng)級別復制此文件,并且 Eclipse 已打開,請按 <F5>
并在包管理器中突出顯示項目,以便 Eclipse 獲取更改.更簡單的方法是將它拖出 SDK 并將 JAR 放入 Eclipse 中的 libs/
中,這將更新文件系統(tǒng)并讓 Eclipse 知道更改.
If you use Eclipse, if you copy this at the filesystem level, and Eclipse is open, press <F5>
with the project highlighted in Package Manager so Eclipse picks up the changes. Easier is to drag it out of the SDK and drop the JAR into libs/
right in Eclipse, which will both update the filesystem and let Eclipse know about the change.
添加 JAR 的 Eclipse 選項(右鍵單擊項目,然后從上下文菜單中選擇 Android Tools > Add Support Library...)也可能會執(zhí)行此操作.由于我的開發(fā)環(huán)境的一些特殊性,這種特殊方法對我不起作用.
It's possible that the Eclipse option to add the JARs (right-click over the project, then choose Android Tools > Add Support Library... from the context menu) will also do this. That particular approach doesn't work for me due to some peculiarities with my development environment.
這篇關于Android:導入DrawerLayout無法解決的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!