문제

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?

도움이 되었습니까?

해결책

<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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top