Java onTouchEvent()仅适用于空空间?
我相信很多其他人在过去的某个时候也会遇到这个问题 My main.xml分为9个Java onTouchEvent()仅适用于空空间?,java,android,onclick,touch-event,Java,Android,Onclick,Touch Event,我相信很多其他人在过去的某个时候也会遇到这个问题 My main.xml分为9个LinearLayouts,权重为1,weightsum当然是9。 1布局中充满了空白 我的活动中有一个onTouchEvent()函数,它工作得非常好。问题是触摸只能在空布局中识别。其他版面则由按钮、编辑文本和文本视图填充。但是触摸事件在那里不起作用。我认为按钮的“onClick”是在调用onTouchEvent()之前调用的 有没有办法让触摸屏在整个屏幕上工作 我没有提供任何代码,因为这是一个一般性的问题,按照我
LinearLayouts
,权重为1,weightsum
当然是9。
1布局中充满了空白
我的活动中有一个onTouchEvent()
函数,它工作得非常好。问题是触摸只能在空布局中识别。其他版面则由按钮、编辑文本和文本视图填充。但是触摸事件在那里不起作用。我认为按钮的“onClick”是在调用onTouchEvent()
之前调用的
有没有办法让触摸屏在整个屏幕上工作
我没有提供任何代码,因为这是一个一般性的问题,按照我的说法,不需要任何代码。
提前感谢您。因为正如所说:
onUserInteraction()
当屏幕上任何地方发生任何触摸事件时调用的方法
onTouchEvent (MotionEvent event) Called when a touch screen event was not handled by any of the views under it.
This is most useful to process touch events that happen outside of your window bounds,
where there is no view to receive it.