Graphical bug while changing fragment with API 21

2020-02-29 10:39发布

I have a graphical problem with my nexus 5. While I changing fragment, before new fragment appears, there is this big square with a portion of the new fragment. The transition isn't smooth.

picture

I use getSupportFragmentManager() for fragment. With the emulator(API 21) and other devices(API < 21) is all ok, with my device(API 21) i have this problem. Some ideas?

EDIT: This error occurs only when (and every time) a fragment is replace, not when it is added.

2条回答
做自己的国王
2楼-- · 2020-02-29 11:09

SOLVED!!!

I've found the solution. I've set the background color of root activity(also if it is never shown like in my case) and the graphical glitch is gone.

爷的心禁止访问
3楼-- · 2020-02-29 11:20

This seems to be a bug in the android graphics lib on all nexus devices. I have a similar issue using the FragmentManger, see

To fix this issue on nexus devices, add the

<application android:hardwareAccelerated="false">

tag, but this will make the app very slow.

EDIT:

There are several Threads in the Google issue tracker or at stackoverflow describing this problem

Issue 82631

Stackoverflow

查看更多
登录 后发表回答