How to configure the Sherlock Action Bar + the map

2019-03-30 09:06发布

问题:

Because it takes me a lot of time to integrate the Sherlock Action Bar in my Android project (with its map plugin !), I propose to depict here my solution.

回答1:

First step consists to create a library project, second to create your own project that will use the Action Bar and third step enables to use the map plugin.

I - ActionBar SHerlock project :

  1. download the actionbarSherlock zip file
  2. import existing Android code into Workspace (for ActionBar 4.2.0). select the directory "library" to import. A "library" project is created.
  3. set your manifest with "android:minSdkVersion="7" android:targetSdkVersion="16"
  4. Import compatibility library: right click on the project > Android Tools > Add Support Library
  5. configure this project with the following Project properties :

    • android build target : >= android 4.0
    • check "Is Library"

II - Your project :

  1. create your project that use Action Bar sherlock
  2. set Android Build Target to >= Android 4.0 (choose the same target than the previous project !)
  3. set your manifest with "android:minSdkVersion="7" android:targetSdkVersion="16"
  4. add the previous project "ActionBarSherlock" as a library : Project > Properties > Android > Add... (bottom panel)
  5. Change your code to use the ActionBar classes

III - To use the actionbarsherlock-plugin-maps-4.1.0.jar plugin of Action Bar Sherlock :

  1. add the actionbarsherlock-plugin-maps-4.1.0.jar (obtained from the zip file) to the project "ActionBarSherlock" in the libs directory
  2. configure the project : project > properties > build path > Librairies :

    - add actionbarsherlock-plugin-maps-4.1.0.jar
    
  3. set the build target to Google map API >4.0 (do the same for your project - same target !)

  4. add the "actionbarsherlock-plugin-maps-4.1.0.jar" library to the new project’s build path

I Hope it will also work for you.