Reputation: 2005
I use jfeinstein10/SlidingMenu as my slidingmenu for my app and the slidingmenu will change different fragment for a activity.When the fragment contains only one or two items it seems good.But if I tried to make the fragment contains more thing ,the slidingmenu will be a short stop when I change the fragment.The animation is not smooth
Is there anyway to slove the problem?Thanks.
Upvotes: 1
Views: 1189
Reputation: 2799
I have a somewhat clunky solution for this but it works okay.
I use a base class for my fragments which is called BaseFragment
. In this class I override the onResume
method and close the menu if it is showing:
@Override
public void onResume() {
super.onResume();
if(sm.isMenuShowing()){
sm.showContent();
}
}
sm
is a reference for a SlidingMenu
from the SlidingFragmentActivity
.
This will make the animation smoother but it will create a small delay between the click on a menu button and the start of the close animation. In my case this worked better then when the animation stops mid-animation.
Upvotes: 1
Reputation: 131
I experience same animation lag when I'm showing heavy fragment. I tried to close menu with animation and show fragment with animation at same time. The animation was laggy, even with native drawer.
So the way to go is:
set menuOnClose listener
on menu item click remember the choice
close menu
in onCloseListener show fragment.
that works great for me.
Upvotes: 2