I'm trying to implement new Android Google Maps API (v2). However it doesn't seem to go well with SlidingMenu. As you may know, MapFragment
implementation is based on SurfaceView
. The problem is that the SurfaceView
doesn't like moving it around - I mean placing it in movable views:
When you move it, it leaves a black hole in the place where its pixels originally layed. It looks something like this.
This problem can be partially solved by specifying a transparent background on the SurfaceView
or even placing a transparent View
over it. I just can't figure if only for me the results are unacceptable, or if I have a different problem which makes it look how it looks.
To see how it looks, please watch THIS VIDEO.
(sorry for the quality, but the problem can be seen easily anyway)
When a normal listview (the orange screen) is pulled away while opening SlidingMenu
, the animation is smooth and nice. But as soon as the MapFragment
appears, there's some weird refreshing/flickering/synchronization issue on the map.
Tested on HTC One S and Samsung Galaxy ACE.
My super-duper-crazy idea of solving it: each time the opening animation starts, take a screenshot of the MapFragment
(it should be possible with SurfaceView) and lay it over for the duration of the animation. But I really don't know how to do it...
Taking screenshot of a map isn't possible, but maybe someone will get inspired by this.
Or maybe disable redrawing the map some other way, I don't know.
UPDATE:
Found this.
It appears that SurfaceView can be changed to TextureView to remove those limitations. But since MapFragment is based on SurfaceView, I don't know if it can be achieved.
Another update
It appears that this issue has been resolved on devices 4.1+. They just used TextureView. but on lower versions we still have to use workarounds.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…