如何在Android中使用这个库?
我想使用这个库为我的应用程序制作一些 ActionBar: https://github.com/johannilsson/android- actionbar 但我不知道如何将它导入到我的 android 项目中。没有 jar 文件。我该怎么办?
弗洛
I want to make some ActionBar for my application using this library: https://github.com/johannilsson/android-actionbar but I don't know how to import it in my android project. There is no jar file. How can I do?
Flo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,确保您使用的是最新版本的 Android SDK,在过去的几个月里,情况已经有了显着的改善。
安装 android-actionbar 源代码,下载并解压它,或者(最好)使用 git 将存储库克隆到您的系统上。
(我强烈建议使用imit-native-api分支,因为它是最新的。)
将 android-actionbar 项目导入 Eclipse。请注意,该库的 .project 文件位于 android-actionbar/actionbar 中。 android-actionbar/actionbarexample 中也有一个小示例项目。
项目的库设置应该已经设置,但是您可以通过右键单击 Eclipse 中的 android-actionbar 项目,选择“属性”并确认在 Android 设置类别中启用“Is Library”来确认这一点。
在 Eclipse 中,右键单击要在其中使用操作栏库的项目,然后选择“属性”。在左侧列表中选择“Android”类别。在右侧的“Library”设置中,单击“Add...”按钮,选择 android-actionbar 库项目。
提示:我发现当您编辑库代码时,Eclipse 可能会有点奇怪,如果您遇到不想消失的错误,请使用 Project > 。 Clean...删除 R.java 文件等...然后刷新包资源管理器并重建。
First, make sure you're using the latest version of the Android SDK, things have improved dramatically within the last few months.
Install the android-actionbar source code, either downloading it and unpacking it, or (preferably) using git to clone the repository on your system.
(I strongly recommend using the mimic-native-api branch as it is the most up to date.)
Import the android-actionbar project into Eclipse. Note that the library's .project file is located in android-actionbar/actionbar. There is a small sample project in android-actionbar/actionbarexample as well.
The project's library setting should already be set, but you can confirm this by right-clicking on the android-actionbar project in Eclipse, choosing Properties, and confirming that "Is Library" is enabled in the Android settings category.
In Eclipse, right-click on the project that you want to use the action bar library in, and choose Properties. Select the "Android" category in the list on the left. In the "Library" settings on the right, click the "Add..." button and select the android-actionbar library project.
Tip: I've found Eclipse can get a bit squirrely when you edit library code, if you run into errors that don't want to go away, use Project > Clean... to remove the R.java files, etc. ...then refresh your package explorer and rebuild.
您需要查看 http://developer.android。 com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject 和 http://developer.android.com/guide/developing/projects/projects -eclipse.html#ReferencingLibraryProject。第一个链接解释了如何创建库项目:您可能只需要获取 github zip 文件,将其展开,然后将其添加到 Eclipse。然后您可以将其导入到您自己的 Eclipse 项目中。
You'll want to look at http://developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject and http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject. The first link explains how to create a Library project: you probably just need to take the github zip file, expand it and then add it to Eclipse. You can then import it into your own project in Eclipse.
只需将源代码复制到项目文件夹中并将每个文件添加为新类
Just copy the source into your project folder and add each file as a new class