Не работают события onTouch, onScale на ScrollView
Нужно перехватить событие onScale на ScrollView. Поставил точки останова на onTouchEvent и onScale.
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
private class ScaleListener extends ScaleGestureDetector.
SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
scale *= detector.getScaleFactor();
return true;
}
}
Тыкаю за пределами ScrollView - точки останова срабатывают нормально. Внутри - нифига. Если в xml меняю ScrollView на RelativeLayout - начинает нормально отлавливать событие.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:id="@+id/myTable"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:stretchColumns="*">
<TableRow>
<TextView
android:text=" Text" />
<TextView
android:text="0"/>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Почему скролл игнорит и как с этим бороться?