How to use the sliding menu with ActionBar Sherlock?

I am trying to use a sliding menu in my existing project that uses the Sherlock action bar. But I can’t do it. If you can give me a simple demo or tutorial to show me how to do this, would that be great? Do I need to use fragments for the sliding menu?

Update:

How to change the action when the user clicks on the list item of the sliding menu?

Is there a demo? please, help.

+4
source share
3 answers

Do as they say in https://github.com/jfeinstein10/SlidingMenu

  • Create your own rolling layout.
  • In onCreate:

    setBehindContentView(R.layout.slide_menu); getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width); getSlidingMenu().setShadowDrawable(R.drawable.shadow); getSlidingMenu().setBehindOffsetRes(R.dimen.actionbar_home_width); getSlidingMenu().setBehindScrollScale(0.25f); 
  • And in action:

     @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggle(); return true; } return super.onOptionsItemSelected(item); } 
+5
source

Edit SliderMenu Library to SherlockActivity SliderMenu

 public class SlidingActivity extends SherlockActivity implements SlidingActivityBase { 
+10
source

I did not find this very clear from the instructions ( SlidingMenu GitGub )

Here is a screenshot to make it clearer: enter image description here

+3
source

All Articles