Navigation Drawer is slow with complex view

后端 未结 2 445
谎友^
谎友^ 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).

提交回复
热议问题