jfeinstein10 / SlidingMenu

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
Apache License 2.0
11.08k stars 5.05k forks source link

SlidingMenu Toggle() lag/blinking #622

Open marcelotadeujr opened 10 years ago

marcelotadeujr commented 10 years ago

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 commented 10 years ago

Can someone help me?

ghost commented 10 years ago

@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.

marcelotadeujr commented 10 years ago

@hearbeathorror , thanks for repply.

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

marcelotadeujr commented 10 years ago

@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)

ghost commented 10 years ago

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

marcelotadeujr commented 10 years ago

@hearbeathorror thank you !

ErNaveenSingh commented 10 years ago

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

torinnguyen commented 10 years ago

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.

subodh-malgonde commented 9 years ago

@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?

piotrros commented 9 years ago

@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".

zzg111222 commented 8 years ago

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

mickyarun commented 8 years ago

@torinnguyen Thanks for that fix!