Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I was stuck on a similar problem until I looked at the documentation and realized that <code>MapView</code> extends <code>ViewGroup</code>, so overlaying a <code>GlSurfaceView</code> actually ends up being pretty trivial. </p> <p><code>MapView.addView(...)</code> and <code>MapView.LayoutParams</code> allow you to some pretty useful things like place a <code>View</code> at a specific <code>GeoPoint</code> on the map.</p> <p>More documentation: <a href="https://developers.google.com/maps/documentation/android/reference/com/google/android/maps/MapView.LayoutParams.html" rel="nofollow">https://developers.google.com/maps/documentation/android/reference/com/google/android/maps/MapView.LayoutParams.html</a></p> <p>Here's what I did:</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.mapview); MapView map_view = (MapView) findViewById(R.id.map_view); CustomGlView gl_view = new CustomGlView(this); // This is where the action happens. map_view.addView(gl_view, new MapView.LayoutParams( MapView.LayoutParams.FILL_PARENT, MapView.LayoutParams.FILL_PARENT, 0,0, MapView.LayoutParams.TOP_LEFT ) ); } </code></pre> <p>Plus also do what the solution above states. I sub-classed GlSurfaceView, so mine looks slightly different:</p> <pre><code>public CustomGlView(Context context) { super(context); YourCustomGlRenderer renderer = new YourCustomGlRenderer(); setEGLConfigChooser(8, 8, 8, 8, 16, 0); setRenderer(renderer); getHolder().setFormat(PixelFormat.TRANSLUCENT); // Have to do this or else // GlSurfaceView wont be transparent. setZOrderOnTop(true); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload