Is it possible add LinearLayout on GLSurfaceView? How to overlay LinearLayout over a GLSurfaceView? maybe GLSurfaceView is Game playground and LinearLayout is menubar~
Asked
Active
Viewed 3,208 times
1 Answers
12
Use a FrameLayout. Have the GLSurfaceView as the first view in the FrameLayout, then add the LinearLayout second. This will put the linearLayout and anything in it over the top of the GLSurfaceView:
<FrameLayout
android:id="@+id/graphics_frameLayout1"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent">
<android.opengl.GLSurfaceView
android:id="@+id/graphics_glsurfaceview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</android.opengl.GLSurfaceView>
<LinearLayout
android:layout_height="fill_parent"
android:id="@+id/linearLayout1"
android:gravity="center"
android:layout_width="fill_parent"
android:orientation="vertical">
</LinearLayout>
</FrameLayout>
Edit: Now with picture:

James Coote
- 1,975
- 19
- 29
-
I have done essentially this with JAVA instead of xml but the glSurfaceView has an inherent onDraw Method and it appears that this method always brings the glSurface back to the top.. – erik Jul 21 '12 at 15:59
-
How are you using glSurfaceView? Are you extending it or attaching a Renderer? – James Coote Jul 21 '12 at 20:44
-
Extending it and doing relview.addview(glView); – erik Jul 21 '12 at 21:50
-
I use GLSurfaceView.Renderer. I forgot how to do it with just extending GLSurfaceView :P. Maybe post as a separate question if you haven't already, along with the code? – James Coote Jul 22 '12 at 12:30
-
I have http://stackoverflow.com/questions/11596778/how-to-build-a-gui-hud-over-top-a-glsurfaceview-in-android – erik Jul 22 '12 at 15:51
-
@JamesCoote You seem to have great knowledge on these type of situations with OpenGL. Do you think you could help me on this posting? https://stackoverflow.com/questions/22749898/android-opengl-glsurfaceview-using-gridview-surface – MAXGEN Mar 30 '14 at 21:09