2
我有一些視圖層次父視圖不趕滾動手勢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TOP_VIEW_LAYOUT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" >
</LinearLayout>
<BASearchView
android:id="@+id/SEARCH_FIELD"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</BASearchView>
<BalanceView
android:id="@+id/CARD_INFO_FIELD"
android:layout_width="match_parent"
android:layout_height="44dp"/>
</LinearLayout>
其中public class BASearchView extends LinearLayout
和public class BalanceView extends RelativeLayout
。我也有public class TopView extends LinearLayout
其中使用TOP_VIEW_LAYOUT
..所以,時間的問題。我試圖調度用戶事件TopView
類
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
Log.i(TAG, "dispatchTouchEvent() has been called");
mGestureDetector.onTouchEvent(event);
return super.dispatchTouchEvent(event);
}
其中mGestureDetector是SimpleGestureDetector
private SimpleOnGestureListener mGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float vx, float vy){
Log.i(TAG, "TopView fling has been detected");
return false;
}
public boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
Log.i(TAG, "TopView scroll has been detected");
return false;
}
};
的對象,我有一個問題.. onScroll
(根據手勢檢測器)被稱爲只有當啓動內點BASearchView
,不在BalanceView
..爲什麼?? !!我不明白:(