4

My setup is the following. I have an Activity with 3 Fragments in a ViewPager. The first and the last Fragment are inflated via xml whereas the center Fragment is a Class derived directly from SurfaceView. This Class has its own rendering thread.

The Project uses ActionBarSherlock 4.0.2 and also the Support Library V4+.

Problem: When the SurfaceView is shown and I swipe to one of the other Fragments these Fragments are not rendered during the transition. IOW instead of scrolling in the other Fragments the SurcaceView leaves behind previous rendered artefacts (smear). Once the transition is completed the target Fragment is shown though. Swiping from one of the outer Fragments to the SurfaceView in the center works as expected.

Possibly related problem: When using the tabs in the ActionBar to perform the transition instead of swiping the target Fragments are not rendered at all. Although nothing is rendered the controls are active. Eg pressing the (invisible) buttons causes the assigned actions. This causes a refresh making the view visible.

instead of posting the source code I put it all on GitHub

I have tried a lot to find the root cause of the behaviour but to no avail.

  • Using another non SurfaceView Fragment in the middle works fine.

  • Wrapping the SurfaceView in a LinearLayout View did not make a difference.

  • Switching off the Threadand all custom drawing inside the SurfaceView had no effect.

Any ideas, suggestions and ideas are welcome.

  • Did you ever find a solution to this? I think it is just a case of surfaceviews not playing nice with viewpagers, not related to ABS. – Daniel Smith Jun 18 '13 at 00:33

0 Answers0