SSISO Community

시소당

Is it possible to overlay EditText box on a GLSurfaceView on Android?

I found the correct way of doing this (This code is in the Activity class)

view = new MyGLSurfaceView(this, gameHandler);
editBox = new EditText(context);
editBox.setText("Hello Matron");

view.setRenderer(new OpenGLRenderer(gameHandler));
setContentView(view);

addContentView(editBox, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

The key is using addContentView method on the Activity class to add the editBox on top of the GLSurfaceView.

Hope this helps some googlers :)

Thanks! Ash

475 view

4.0 stars