Sherlock Action Bar with Sliding menu
Asked Answered
O

4

5

I'm making a view and an activity extending SherlockMapActivity and using SlidingMenu libraries to make my main view to scroll like Google+ does. I've added the SlidingMenu by XML and my view scrolls perfectly showing the hidden menu but it only scrolls the view below the action bar. In Google+ app it also scrolls the action bar and I've seen there's a function for making my action bar sliding enabled but it does not work.

What would be the best way to make my action bar sliding with the full view? Maybe I'm not extending the correct class?

This is how I add the SlidingMenu to my app:

XML File:

<com.slidingmenu.lib.SlidingMenu
    xmlns:sliding="http://schemas.android.com/apk/res-auto"
    android:id="@+id/slidingmenulayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    sliding:viewAbove="@layout/activity_main"
    sliding:viewBehind="@layout/menu_desplegado"
    sliding:behindOffset="120dip"
    sliding:behindScrollScale="0.25"
 />

And this is the result:

Main Layout Screenshot

Orogeny answered 31/7, 2012 at 23:1 Comment(3)
Sorry there isn't much code here, but here is an article about what you're trying to do: android.cyrilmottier.com/?p=658Hezekiah
@Orogeny can you post some instructions on how u implemented actionbarsherlock along with sliding menu. i m having trouble.Horsley
@Horsley You can implement it by going to the SlidingMenu project, open every Sliding__Activity and modify all "extends" to "extends Sherlock__Activity". You will need to add Sherlock libraries to the SlidingMenu project and then clean project and compile. Then you just have to add this new SlidingMenu library into your project and use it by extending your activity from Sliding__Activity.Orogeny
O
9

I've solved my problem.

In order to make my Action Bar to Slide, I had to modify the SlidingMenu this way:

  1. Checkout a clean copy of ActionBarSherlock and import into your Eclipse workspace.
  2. Add ActionBarSherlock as a dependency to SlidingMenu.
  3. Go into the SlidingActivities that you plan on using make them extend Sherlock__Activity instead of __Activity.

Then I extended my MainActivity from SlidingMapActivity and it worked perfectly.

Orogeny answered 2/8, 2012 at 9:53 Comment(6)
is there any link for this tutorial or can you explain this code?Privy
@Pratik Butani - it's a direct quote from the github README, here: github.com/jfeinstein10/SlidingMenu/blob/master/README.mdMisha
@Misha How to call activity on click of menu items in Sliding MenuPrivy
@PratikButani you should probably ask a full question.Misha
@Misha I have Sliding Menu with 5 menu items, i want to open activity while clicked on menu, how its possible?Privy
@Misha You can handle that in the same way you would do if you only had a menu. I guess your menu is a ListView so you have to start the new Activity by adding an onClickListener for each menu entryOrogeny
H
2

Okay I think I found your answer. Try checking out this project on github: https://github.com/jfeinstein10/SlidingMenu

Here is a video of it in action: http://www.youtube.com/watch?v=8vNaANLHw-c&feature=youtu.be

Hezekiah answered 1/8, 2012 at 17:33 Comment(3)
I'm using that library on my project but there is not too much documentation about how to use it. I'll take a deep look at the whole project to see if there's anything I'm missing. Thanks for the answer!Orogeny
Are you using setSlidingActionBarEnabled(true) ?Hezekiah
Yes, I found it googling a while but it still does not work. In order to use that function, I've extended my MainActivity SlidingMapActivity instead of SherlockMapActivityOrogeny
T
2

In my case, I prefer to add this slideMenu in code.

Well, when you create this SlideMenu:

menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);

then set this line too:

menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);

This makes the magic!.

Telephoto answered 13/4, 2013 at 21:17 Comment(1)
is there any link for this tutorial or can you explain this code? @TelephotoPrivy
L
1

Here is a complete project developed by me for easy sliding menu developer http://github.com/leonardosalles/shipp-sliding-menu

Lobell answered 25/1, 2013 at 1:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.