How to use Sliding Menu with ActionBar Sherlock?

后端 未结 3 497
借酒劲吻你
借酒劲吻你 2021-02-02 04:27

I am trying to use a sliding menu in my existing project where action bar Sherlock is used. But I am unable to do that. If you can give me a simple demo or tutorial to show me h

相关标签:
3条回答
  • 2021-02-02 04:56

    Edit library SliderMenu to extents SherlockActivity

    public class SlidingActivity extends SherlockActivity implements SlidingActivityBase {
    
    0 讨论(0)
  • 2021-02-02 05:02

    Do as it says in https://github.com/jfeinstein10/SlidingMenu

    1. Create your sliding layout.
    2. 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);
      
    3. And in the activity:

      @Override
          public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
          case android.R.id.home:
              toggle();
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
      
    0 讨论(0)
  • 2021-02-02 05:15

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

    Heres a screenshot to make it more clear: enter image description here

    0 讨论(0)
提交回复
热议问题