android - What should I do to a get smooth navigation drawer close on navigation item click -


i have used basic navigation drawer generated in android studio. noticed navigation slider slides off smooth , lag sometimes. found lag cause of layoutinflater used inflate layout on fragment.

what have done is,

viewgroup mylayout = view.findviewbyid(r.id.current_layout); view maylayouttwo = layoutinflater.from(currentfragment.this.getactivity()).inflate(r.layout.cardview_to_inflate, mylayout, false); mylayout.addview(maylayouttwo); 

i want know possible avoid lag on navigation drawer slide. me fix issue.

navigation drawer multiple fragments common usage. based on fragments loading @ oncreate() lifecycle stage, naviagtion drawer may not smooth while closing.

so solution 1 : avoid heavy loading @ fragment initiate state. (e.g loading data asynchronously.)

solution 2 : display place holder view (e.g whit screen) while navigation drawer closing. once nv drawer closed, show fragment.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -