I am using Sliding Menu lib (link) for getting the sliding menu like Facebook app and its really very cool.
I have integrated it into my project by using following code and its working.
slidingMenu = new SlidingMenu(this);
slidingMenu.setMode(SlidingMenu.RIGHT);
slidingMenu.setShadowDrawable(R.drawable.shadowright);
slidingMenu.setShadowWidth(80);
slidingMenu.setBehindScrollScale(0);
slidingMenu.setBehindOffsetRes(R.dimen.behind_offset);
slidingMenu.setFadeDegree(0);
slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
slidingMenu.setMenu(R.layout.popupmenu);
But issue is when I click on right most button to get sliding menu It slide as I want but the transition is not smooth. It start to slide stuck for fraction of seconds and again continue to slide.
So how can I use it to slide smoothly.
I found solution for my problem.
What I did is just add
android:hardwareAccelerated="true"
in application tag in AndroidManifest.xml.
So now its sliding smoothly as I wanted.
It's possible that the view hosted in your "content" on "menu" area of the sliding menu is redrawing through the animation at a big cost.
Try to "pause" its redrawings while the menu is sliding and/or optimize this redrawing.
That's, at least, the issue I had. It's likely you have the same.
Actually ,When you want to switch ,You can use this
showContent(false) or toggle(false) which will prevent the so-called smoothly scroll and transition immediately (It is so-called smoothly scroll that cause to lag ) .
Related
I have the following problem. I noticed that on Android 4.4.2 (and possibly all 4.4.x) the NavigationDrawer does not work exactly as in lower version. It works fine, when opened via click in the ActionBar icon. But when I tried to open it by swiping from the side around the middle of the screen, only small grey area comes in instead of my NavigationDrawer. It looks like this.
I also noticed, that I am not the only one who has this kind of problems, as both Evernote and Duolingo suffers from the same problem. Is there anyway to make the drawer open correctly by swiping from the side ?
I added the Drawer exactly the way described here.
Edit : When I drag from the top left corner, everything is fine, but when I drag from the left edge somewhere in middle of the screen, something weird shows instead of a drawer. See the first link for the screenshot.
I have a project where the designs require a sliding drawer that comes from the bottom and has essentially three states.
fully collapsed (just the handle at the bottom
half mast (drawer opens from bottom but only halfway up the screen
full mast (drawer opens from bottom and takes up the whole screen minus a top margin of lets say 80dp
I am developing for android 4.0 and higher and obviously sliding drawer is deprecated. But the Navigation drawer only supports left and right (which i already have in use)
So i am wondering if anyone knows a tutorial or even a custom component someone has written that meets the above functionality requirements
In my experience, you probably have to create something yourself, but since you're developing for api lvl 14, check out ObjectAnimator. It allows you to move Views around and still use them (by that I mean that it's the original view that has been moved and not a copy of it)
This will probably be the easiest way.
FYI, using the Navigation Drawer, you can't open the drawer halfway, or you should programmatically invoke touch events...
I think this is what you are looking for.
I have found this library best so far for sliding up menus in Android.
https://github.com/umano/AndroidSlidingUpPanel
You can specify what screen area slide up menu or view will use.
Accept & vote up my answer if it is what you are looking for.
I'm using the slide menu library and setting the menu offset from a xml.
setBehindOffsetRes(R.dimen.slidingmenu_offset);
when I click the menu item I use
menu.toggle(true);
which moves the content to left with menu behind it. My scenario is when I click the menu item, the content has to move all the way to right and then should bring the content in like the normal way so that the user dont get to see the UI change. I used
setBehindOffsetRes(R.dimen.slidingmenu_fullscreen);
showMenu(true);
where R.dimen.slidingmenu_fullscreen = 0dp. The menu goes to full screen behind the content, but the content doesn't moves to the right. Thanks in advance!
Edit 1: This is similar to Xoom application... Sample "Slide Sample"
I would recommend using ActionBarSherlock. Use this tutorial for sliding menu, It is much easier to use, and you will find much more help with it. It is also more compatible with different screen sizes, and more Android versions.
Finally I figured it myself.
menu.mViewAbove.scrollTo(menu.mViewAbove.getScrollX()-200,0);
moved the content to right. But now got into another problem. which I have descibed here->
https://stackoverflow.com/questions/19714871/sliding-menu-move-content-to-right
I am using Sliding Menu and ActionBarSherlock in my application. Since I need to support old APIs so I cannot use the normal action bar.
I have multiple tabs (4-5) on the home page and also the sliding menu library works good. The issue I am facing is related to 2.3+ Android , when I click on any tab of home page and try to slide the tabs it works first time, but once you have scrolled to reach to last tab or any other tab then it is not easy to scroll back to the first tab. Instead the library slides the page and does not slide the tab.
One my Nexus 4 it works without any issues and is very smooth but when I use it on my device with 2.3.5 it is erratic.
Any pointers to this issue would be of great help.
Thanks.
I have encountered this a few times also. The best solution I have seen/used is to change the touch mode of the sliding menu based on the tab being displayed i.e.
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
or
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
when you're away from the first tab. I suggest using TOUCHMODE_MARGIN so that the menu can still be opened. Then, when the first tab is reached you can switch the touch mode back to TOUCHMODE_FULLSCREEN. An Alternative is to keep the touch mode always as TOUCHMODE_MARGIN.
I hope this is of some help.
I tried to implement sliding menu in my application. What i want is that there is a button on the top right corner of the screen. And sliding menu should come up from right to left which is reverse slide of facebook styled sliding. In Jfeinstein Sliding Menu, Sliding menu come out from left to right. I tried to implement the source to make it happen from right to left. But unfortunately, I still can't get it. Any ideas would be appreciate.
There is a branch called "sliding right" in Jfeinstein Sliding Menu on github.
This is a demo project to explore how to implement a sliding menu like Facebook and others use.
android-sliding-menu-demo
android-fb-like-slideout-navigation
I made a video (3 parts) on youtube on how to make a sliding menu like the on you are looking for. I show you how to set up the project and get everything linked up.
http://www.youtube.com/watch?v=tJJMyzdB9uI
The cool thing about ECSlidingViewController (Its the one I use) is that just about everything you want to configure (how far a view slides, the animations, left or right side) is done with a single line of code. When setting it up, I tell you where you can change it to be left or right side.
Hope this helps.