简体   繁体   中英

Android: Implementing SlidingMenu and ABS

I am trying to implement the SlidingMenu from https://github.com/jfeinstein10/SlidingMenu together with http://actionbarsherlock.com/ and I came across a problem that I could not fix myself that's why I turned to the issues page on SlidingMenu's GitHub. But 2 days and I got no reply so I am gonna ask it here.

Basically on the example project provided by jfeinstein10, I copied the SampleListFragment.java file and I've named it MenuListFragment.java on my project. I've made a couple of changes but those should not be an issue.

I also copied the menu.xml from the layout directory but changed its name attribute to the previous file including the package.

Project builds properly and no errors are encountered. Time to run the project.

Now on my project's main activity, when I call the setMenu(R.layout.menu); statement during runtime, it gives me an error which tells me something about ClassCastException (cannot cast com.dokgu.dota2stats.MenuListFragment to android.app.Fragment ).

I've tried a couple of things like change the MenuListFragment.java to extend the android.app.Fragment instead of ListFragment but it didn't solve the problem and more issues came up because of that.

So please, can anyone help me with this please? I really want to make this work.

You can find the issue here as well: https://github.com/jfeinstein10/SlidingMenu/issues/546

Actionbarsherlork支持自android 2.x以来的较低杠杆版本,而slidemenu需要android 3.0+。也许您可以添加android-support-v4.jar,其中slidemenu项目中的某些片段和活动会扩展到该版本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM