SlidingMenu icon indicating copy to clipboard operation
SlidingMenu copied to clipboard

SlidingMenu Toggle() lag/blinking

Open marcelotadeujr opened this issue 11 years ago • 12 comments

Hi all!

First, thank's for the library @jfeinstein10 , its awesome!

Im making my app on ADT with our library from the master branch... I've made the menu slide implementation and have some trouble with toggle() function.

Menu still lag's just on "open" event and don't seem smoother slide animation...

I've try'd switch targetsdk from 19 to 14 and minsdk to 8 but problem still...

My MainActivity:

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout);

        menu = new SlidingMenu(this);        
        menu.setMode(SlidingMenu.LEFT);        
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
        menu.setShadowDrawable(R.drawable.shadow);
        menu.setShadowWidthRes(R.dimen.shadow_width);
        menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
        menu.setBehindScrollScale(0.25f);
        menu.setFadeDegree(0.25f);
        menu.setMenu(R.layout.sliding_menu); 
    });

sliding_menu.xml is one listview with one imageview (small icon) and one textview (description of menuitem), background color = #FFF

Any suggestions? Thanks!

EDIT: I've looked strange logs on logcat while i try to open, close and open again the menu, it seems one error on first "toggle()" event on my application, then runs normal on close toggle, and on second open event, it seems to pass 3 times on "open" event..

First Open logcat_firstopen

First Close logcat_firstclose

Second Open logcat_secondopen

marcelotadeujr avatar Mar 26 '14 05:03 marcelotadeujr

Can someone help me?

marcelotadeujr avatar Mar 27 '14 11:03 marcelotadeujr

@BM9MobileBrasil have you added hardwareAccelerated=true to the manifest? I had the same issue earlier, then added the tag to the manifest and it seemed to run well.

ghost avatar Mar 27 '14 12:03 ghost

@hearbeathorror , thanks for repply.

Yes, i have added hardwareAccelerated=True on applycation manifest but no success =(

marcelotadeujr avatar Mar 27 '14 13:03 marcelotadeujr

@hearbeathorror , lag's more while i set background color and put some small size icons (less then 3kb each - have 5 menu itens), and one image for user profile (lass then 200kb)

marcelotadeujr avatar Mar 27 '14 13:03 marcelotadeujr

@BM9MobileBrasil I am afraid i have no clue why that could be happening :(..unless you wait patiently for a response :)

ghost avatar Mar 28 '14 04:03 ghost

@hearbeathorror thank you !

marcelotadeujr avatar Mar 28 '14 05:03 marcelotadeujr

@BM9MobileBrasil were you able to find a solution to this.

ErNaveenSingh avatar Jun 30 '14 11:06 ErNaveenSingh

I have no idea what exactly I'm doing but I got a workaround/hack for this. In CustomViewBehind.java, around line 214, make this change

image

As said, I have no idea what I'm doing, just guessing by keeping the behind view visible all the time, we don't need to re-build the cache or something along that line.

torinnguyen avatar Jul 17 '14 15:07 torinnguyen

@jfeinstein10 : This issue doesn't seem to be there in the demo app on PlayStore. Can you tell us what can we possibly do wrong, that leads to the content lagging behind?

subodh-malgonde avatar Sep 26 '14 07:09 subodh-malgonde

@torinnguyen Thanks for that fix! It worked :)

Dunno why this is happening. My app is pretty simple. What may be important I use fragments. I have an activity with mainlayout, which is later replaced by fragment. Inside this fragment I'm creating SlidingMenu instance and attaching it to activity. And while opening up menu I can see "white" blink. Does not occur when closing. Does happen if you swipe screen, but you have to do it really really fast. Hardware acceleration didn't make any difference neither changing background color in "sliidingmenumain.xml".

piotrros avatar Jul 08 '15 20:07 piotrros

@torinnguyen Thanks, your solution also help me. This problem puzzled me a long time

zzg111222 avatar Oct 10 '15 07:10 zzg111222

@torinnguyen Thanks for that fix!

mickyarun avatar Jul 01 '16 11:07 mickyarun