1. Are you ready for the Galaxy S20? Here is everything we know so far!

After setContentView element SurfaceView draw under StreetViewPanoramaView

Discussion in 'Android Development' started by Valera_1987_01, Mar 1, 2019.

  1. Valera_1987_01

    Thread Starter

    Hello. First time here.
    I create application with StreetView. Want draw markers on top Street View panoramas.

    Switch between layouts with setContentView(). On layout with element "StreetViewPanoramaView extends FrameLayout" (com.google.android.gms.maps) i have element "StreetOverlayView extends SurfaceView".
    With "Canvas canvas = surfaceHolder.lockCanvas();" i draw bitmap on SurfaceView.

    SurfaceView draw bitmap

    after setContentView all time look like:
    SurfaceView draw bitmap

    I tried different options:
    1) first setContentView(layout with StreetViewPanoramaView) and bitmap draw on top and look good.
    After i setContentView(another layout) and again setContentView(layout with StreetViewPanoramaView) - bitmap NOT draw : ( on top - only under StreetViewPanoramaView.

    2) first setContentView(another layout) and after setContentView(layout with StreetViewPanoramaView) - bitmap NOT draw : ( on top.

    I tried "bringChildToFront" with elements in layout - not work.

    How can i return SurfaceView with canvas draw on top ?

  2. Valera_1987_01

    Thread Starter

    I have solution:
    Put "StreetOverlayView extends SurfaceView" element in new FrameLayout and after setContentView i remove my element from this FrameLayout and add again.

    frame1.removeView( markerView );
    frame1.addView ( markerView );

Share This Page