DrawerLayout's item click - When is the right time to replace fragment?

后端 未结 7 797
轻奢々
轻奢々 2020-12-07 11:16

I\'m developing an application which uses the navigation drawer pattern (With DrawerLayout).

Each click on a drawer\'s item, replaces the fragment in the main contai

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 12:01

    Yup, couldn't agree more, performing a fragment (with view) transaction results in a layout pass which causes janky animations on views being animated, citing DrawerLayout docs:

    DrawerLayout.DrawerListener can be used to monitor the state and motion of drawer views. Avoid performing expensive operations such as layout during animation as it can cause stuttering; try to perform expensive operations during the STATE_IDLE state.

    So please perform your fragment transactions after the drawer is closed or somebody patches the support library to somehow fix that :)

提交回复
热议问题