-1

Need to overlay two views. A GLSurfaceView and a MapView. My map view is following the code from the following Github location:

Android Google Maps v2

The GLSurfaceView needs to be on top of the map view which I believe I just use

zOrderOnTop(true);

However, I do not know how to add this second view to the class. I've been attempting to work with this Stack Overflow question:

How to overlay GLSurfaceView over a MapView in Android?

but have not been able to get it to work... Any suggestions would be appreciated.

Also, from observing the developers reference guide about MapViews, there is a note that says: "You are advised NOT to add children to this view." Would overlaying a GLSurfaceView be adding a child to the MapView?

Community
  • 1
  • 1
Beren
  • 131
  • 1
  • 1
  • 13

2 Answers2

1

in android studio you can create map activity

                    MapFragment mapFragment = MapFragment.newInstance();
                    getFragmentManager().beginTransaction()
                            .replace(R.id.item_detail_container, mapFragment)
                            .commit();
                    mapFragment.getMapAsync(new OnMapReadyCallback() {
                        @Override
                        public void onMapReady(GoogleMap googleMap) {
                            // do some thing 
                        }
                    });

or try this tutorial http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/

0

I asked a similar question to this one that had my source code. I seemed to have found a solution that works currently however, not sure how elegant it is...

GLSurfaceView not appearing over MapView

Basically, I separated my views (MapView and GLSurfaceView) into two fragments. Then I called them from an Activity. The fragments occupied the same area and the GLSurfaceView is called after the MapView.

This works for me. Please let me know if there is a simpler/more elegant way of doing this.

Community
  • 1
  • 1
Beren
  • 131
  • 1
  • 1
  • 13