Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.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
Android OnTouchEvent方法在ScrollView中不响应_Android - Fatal编程技术网

Android OnTouchEvent方法在ScrollView中不响应

Android OnTouchEvent方法在ScrollView中不响应,android,Android,我已经读了更多关于这方面的文章,但我还没有找到任何解决方案,对不起 我有一个带有滚动视图的.xml文件: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ScrollView> 如果我有scrollView,该方法将永远不会执行

我已经读了更多关于这方面的文章,但我还没有找到任何解决方案,对不起

我有一个带有滚动视图的.xml文件:

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

</ScrollView> 
如果我有scrollView,该方法将永远不会执行,但如果我退出scrollView,该方法将非常有效。如何使该方法与scrollView一起工作? 谢谢你的关注和帮助

public class Example extends Activity{

//I have more code

public boolean onTouchEvent(MotionEvent event) {
int x = (int) event.getX();
int y = (int) event.getY();

switch(event.getAction()) {
    case MotionEvent.ACTION_DOWN:

    break;
    case MotionEvent.ACTION_MOVE:

    break;
    case MotionEvent.ACTION_UP:

    break;
}   
return true;
}
}