Remove the white screen a Slide window transition creates when it starts

后端 未结 4 2007
执笔经年
执笔经年 2020-12-31 05:27

I am using an activity with a black background. That same activity has a toolbar and a DrawerLayout as well. This white screen makes the look inconsistent.

It can be

4条回答
  •  一整个雨季
    2020-12-31 05:58

    This is a little late, but I encountered the same thing myself, and found no answer for it in the internet.

    The reason for the gap between the screens is that you call both an exit transition and an enter transition.

    The exit transition happens as soon as you call startActivity, and the enter transition happens later, after the onCreate of the new activity.

    Therefore, the order of events will be:

    1. Activity A exits
    2. Wait for activity B to finish loading
    3. Activity B enters

    For me the solution was to simply remove the exit transition. The outcome looks pretty much the same, and the lack of the exit transition is barely noticeable as a new activity slides over it.

    After removing the exit transition, the time when there was a "white screen" is not seen because in that time Activity A is still present.

提交回复
热议问题