Set up Slidemenu - example not working

2019-01-21 06:03发布

问题:

I'm trying to use the SlideMenu library with ActionBarSherlock. https://github.com/jfeinstein10/SlidingMenu

http://actionbarsherlock.com/

I had not issue installing actionbarsherlock and run the examples provided. But, can't do the same with the example og the SlideMenu library :(

I can set up the library fine (or so i think) without errors (under eclipse with jre6).

For the slidemenu example, i created the project, and added com_actionbarssherlock.jar as a "referenced libraies".

But i have lots of : - R cannot resolve erros ; - can't overrides some methods erros; - methods from actionbarsherlock are not recognized ; ex : "The method getSupportActionBar() is undefined for the type BaseActivity" - can't load style from actionbarsherlock erros.

It is as if the project doesn't see the classes from actionbarsherlock.

Thanks for any help.

回答1:

For the error

"The method getSupportActionBar() is undefined for the type BaseActivity"

Inside the SlidingMenu library, edit the class SlidingFragmentActivity to extend SherlockFragmentActivity (like below). Then clean and rebuild, this method should now be found.

public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {

Source



回答2:

Look add Problems tab to see there are any error ? Right click your project and check your all Libraries. If everthing ok, try to clean your project.



回答3:

There are lots of issues on github with that bug. Mrcb123's solution works, but I suppose it will be good to separate example ABS dependency from library.