Preface
The new project is under intense development. It is estimated that the first version will be developed in two months. I am in charge of Android development. Due to the inconvenience, this series will be named "X project notes ", the project name will be published after the project ends. This series mainly records and shares the Problems and Solutions encountered in the "X Project.
StatementWelcome to repost, but please keep the original source of the article :) blog Park: http://www.cnblogs.com
Farmer's uncle: http://over140.cnblogs.com
Body
Previously encountered abnormal requirements: Android controls the ScrollView sliding speed. This time, it is a self-raised requirement. The Fling function of ListView is disabled, that is, the fast sliding function, and the code is directly added:
/** Gesture Recognition class */
Private class TouchGesture extends SimpleOnGestureListener {
/** Quick scroll */
@ Override
Public boolean onFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY ){
Return true;
}
}
Private OnTouchListener mOnListViewTouchListener = new OnTouchListener (){
@ Override
Public boolean onTouch (View v, MotionEvent event ){
If (mTouchGesture. onTouchEvent (event ))
Return true;
Return false;
}
};
Code Description:
Call setOnTouchListener of ListView to bind mOnListViewTouchListener. The key point is to return true in the onFling method, which means to consume the Fling event and stop uploading the event chain.
End
I found that I have already written several series. Haha, it seems that some of them are coming to an end ~~ Not afraid ~ I continued to launch a new series, but basically reflected my work conditions.