Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java onTouchEvent()仅适用于空空间?_Java_Android_Onclick_Touch Event - Fatal编程技术网

Java onTouchEvent()仅适用于空空间?

Java onTouchEvent()仅适用于空空间?,java,android,onclick,touch-event,Java,Android,Onclick,Touch Event,我相信很多其他人在过去的某个时候也会遇到这个问题 My main.xml分为9个LinearLayouts,权重为1,weightsum当然是9。 1布局中充满了空白 我的活动中有一个onTouchEvent()函数,它工作得非常好。问题是触摸只能在空布局中识别。其他版面则由按钮、编辑文本和文本视图填充。但是触摸事件在那里不起作用。我认为按钮的“onClick”是在调用onTouchEvent()之前调用的 有没有办法让触摸屏在整个屏幕上工作 我没有提供任何代码,因为这是一个一般性的问题,按照我

我相信很多其他人在过去的某个时候也会遇到这个问题

My main.xml分为9个
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.