Pregunta

I want an application that uses Samsung S Pen as input, and draws something with OpenGL ES. Basicly i need two views (both inherited from android.view.SurfaceView)

  • GLSurfaceView
  • SpenSurfaceView

The SpenSurfaceView should be on top, to catch all the input gesture. The GLSurfaceView must be visible too. I might need to change visibility of the SpenSurfaceView (probably with the .setAlpha(float) method )

What is the most common way to implement this?

¿Fue útil?

Solución

<FrameLayout>
  <GlSurfaceView ... />
  <SpenSurfaceView ... />
</FrameLayout>

or, if you can't use resources and the layout inflater:

FrameLayout fl = // get or find frame layout
fl.addChild(yourGlSurfaceView);
fl.addChild(yourSpenSurfaceView);

The greater question is, can you not just draw to the SpenSurfaceView's surface directly? Then you don't need the second GlSurfaceView.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top