Porting Slidingmenu Android Library, and installing example problem solving

Source: Internet
Author: User

Many projects use the same effect as the left swipe menu, such as FACEBOOK,EVERNOTE,VLC for Android and so on, which is cool

The source code can be downloaded from GitHub's https://github.com/jfeinstein10/slidingmenu.

The Actionbarsherlock project will be used during the transplant to http://actionbarsherlock.com/download.html download. (All two under the latest version)

Steps:

1. Extract the files under/library from the downloaded Actionbarssherlock to workspace (your project directory), change the project name to Actionbarssherlock, and operate from Eclipse new->project- >android Project from Existing code adds the item, target changes to more than api14.

2. Extract the downloaded Slidingmenu/library to workspace (your project directory), rename Slidingmenu,import the project, right-click->properties->android-> Api14 above. or open Project.properties:target=google Inc.:google apis:14 or higher.

3. Such slidingmenu can be used in their own projects. Let's run the example. Unzip the Slidingmenu in/example. Import the item, set API14 or higher, and add your slidingmenu. Run to see the effect. More than 2.1 of the system can be run.

Although it is an open source project, there are a number of issues that may arise during use:

I. Fix errors in Slidingmenu library project

    • Console error:unable To resolve target ' Google inc.:google apis:16.

      Fix: Enter properties to check if the target SDK has selected Google APIs.

    • List of Errors:action_pointer_index_mask cannot be resolved Android.
      Honeycomb cannot be resolved or was not a field
      Layer_type_hardware cannot be resolved or was not a field
      Layer_type_none cannot be resolved or was not a field
      Match_parent cannot be resolved or was not a field
      The method Getlayertype () is undefined for the type View
      The method setlayertype (int, null) is undefined for the type View

      Fix: Change the Min SDK version in manifest to the SDK you are currently using, more than 7.

Ii. Fix Errors in example project

    • console error: found 2 versions of Android-support-v4.jar in the dependency list,but not all the V Ersions is identical (check was based on SHA-1 only at this time). Jar mismatch! Fix your dependencies

      fix:  this is caused by inconsistent jar package version, check slidingmenu and Actionbarsherlock \ Which Android-support-v4.jar version in the Libs folder is newer, replace the old version with the new one . If the error still occurs, restart Eclipse on the clean project.

    • List of Errors:the Method Getsupportactionbar () is undefined for the type baseactivity
      The method Getsupportmenuinflater () is undefined for the type baseactivity
      The method Oncreateoptionsmenu (Menu) of type baseactivity must override or implement a Supertype method
      The method onoptionsitemselected (MenuItem) in the type Activity was not applicable for the arguments
      The method onoptionsitemselected (MenuItem) of type baseactivity must override or implement a Supertype method
      The method onoptionsitemselected (MenuItem) of type responsiveuiactivity must override or implement a Supertype method

      Fix: Open Slidingmenu Library project slidingfragmentactivity This class and add the following code before the declaration:

      [Java]View Plaincopy
        1. Import com.actionbarsherlock.app.SherlockFragmentActivity;

      Then, put the following parent class:

      [Java]View Plaincopy
        1. Public class Slidingfragmentactivity extends Fragmentactivity implements Slidingactivitybase { /c5>

      change to a different parent in Actionbarsherlock :

      [Java]View Plaincopy
        1. Public class Slidingfragmentactivity extends Sherlockfragmentactivity implements Slidingactivitybase {

      If the error still occurs, restart Eclipse on the clean Project.

      Run the following effects without errors:

Porting Slidingmenu Android Library, and installing example problem solving

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.