I am currently writing a game for android. I have one normal GLSurfaceView where I am rendering my graphics and using the public boolean onTouchEvent(MotionEvent me)
method to register touch inputs to for example turn the camera. In a separate class I programatically create a FrameLayout
that contains the HUD. This is added on top of the GLSurfaceView with this.addContentView(FL_HUD, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
. The HUD contains an Image View
, that has a touch listener set with .setOnTouchListener
, that creates another Motion event that I can read out.
The TouchListeners/MotionEvents both work, so when I touch my Image View, its TouchListener is called, when I touch somewhere else on the screen, the main Activity's TouchListener is called. But when I try to touch the Image View while touching the screen or try touching the ImageView while touching the screen it doesn't work or in other words, only one touchListener is active at a time.
How do I manage to enable multitouch over two overlaying Views?