Navigation Drawer is slow with complex view

后端 未结 2 427
谎友^
谎友^ 2021-01-05 09:08

In my app i\'m using Navigation Drawer and it works very fine. But if the Fragment to show contains much TextView, ImageView and Layout, when i click the item, the view is g

相关标签:
2条回答
  • 2021-01-05 09:40

    As the documentation says:

    Avoid performing expensive operations such as layout during animation as it can cause stuttering;
    try to perform expensive operations during the STATE_IDLE state.
    

    What you could do, is have an event listener for your drawer, and do the fragment operation in the onDrawerClosed callback (example here).

    0 讨论(0)
  • 2021-01-05 09:41

    I have found that if you load the views in the fragment in the onCreateView() method it will slow down the fragment loading. Try loading the fragment related views in the onStart() method.

    0 讨论(0)
提交回复
热议问题