Blinking screen on image transition between activities

后端 未结 12 2195
温柔的废话
温柔的废话 2020-12-02 07:01

I implemented an image transition between two activities using the new shared elements from lollipop. It\'s working but I get a weird white blinking on the entire screen du

相关标签:
12条回答
  • 2020-12-02 07:22

    I have had similar blinking issues and tried many of the examples mentioned here but for me it didn't solve the issues. What did work for me was changing the window background for the second activity theme to transparent. (@Webdma used black, but in my case that made the screen flash black instead of white)

        <item name="android:windowBackground">@android:color/transparent</item>
    
    0 讨论(0)
  • 2020-12-02 07:22

    I had a similar problem. I solved the blinking status bar and navigation bar issues by excluding them from the transition as per @Alex's suggestion, but the screen was still blinking when switching between the activities. When I removed the "finish();" statement after startActivity(); the screen stopped blinking. May it was due to the closing of calling activity. Hope this helps someone.

    0 讨论(0)
  • 2020-12-02 07:26

    Add this in your style.xml. This prevents the screen from Blinking

        <item name="android:windowIsTranslucent">true</item>
    
    0 讨论(0)
  • 2020-12-02 07:28

    I solved this issue by changing background color of my default theme, hope this is still can help to someone save the time.

    <item name="android:windowBackground">@color/black</item>
    <item name="android:colorBackground">@color/black</item>
    
    0 讨论(0)
  • 2020-12-02 07:28

    The "white blinking" you are seeing is the result of the two activities alpha-animating in and out during the transition: when activity A starts activity B, activity A fades out and activity B fades in.

    If you want to prevent the status bar and/or navigation bar from fading during the transition (and thus reducing the "blinking" effect a bit), you can look at this post.

    0 讨论(0)
  • 2020-12-02 07:32

    On the exiting activity, call getWindow().setExitTransition(null);

    On the entering activity, call getWindow().setEnterTransition(null);

    It will prevent the fade out of the exiting activity and the fade in of the entering activity, which removes the apparent blinking effect.

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