开发者

How to use this library in Android?

I want to make some ActionBar for my application using this librar开发者_StackOverflow中文版y: 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


First, make sure you're using the latest version of the Android SDK, things have improved dramatically within the last few months.

  1. 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.)

  2. 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.

  3. 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜