3

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.

Blodhgard
  • 9,130
  • 3
  • 24
  • 36
  • I noticed similar glitch also with Chrome and other apps while opening new Activities on devices running API 21. That's to say, if even Chrome suffers from this problem, I suppose that is something which is going to get fixed by system updates. Anyone noticed similar problems? If yes in which app? – bonnyz Jan 15 '15 at 13:58
  • Thanks bonnyz...The problem is that in my application this error occur every time i replace a fragment and it is very annoying – Blodhgard Jan 15 '15 at 19:53
  • Why not just take a screenshot so it is more clear? – Jared Burrows Jan 15 '15 at 20:02

2 Answers2

3

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.

Blodhgard
  • 9,130
  • 3
  • 24
  • 36
2

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

Community
  • 1
  • 1
user3749883
  • 184
  • 3
  • 12
  • More correct way to set hardwareAccelerated="false" for an Activity, but not an Application. But still it seems for me as a workaround – Taras Jan 15 '15 at 15:16
  • This will only help if his minSDK is less than 14: http://developer.android.com/guide/topics/manifest/application-element.html#hwaccel. – Jared Burrows Jan 15 '15 at 20:04