This problem occurs when the OnGestureListener gesture slides the interface. When the interface contains ListView, the interface slide of OnGestureListener is intercepted and consumed by ListView.
To solve this problem, you need to override the OnTouchListener interface of ListView:
Java code:
ListView listView = (ListView) findViewById (R. id. listViewBeside );
ListView. setOnTouchListener (new View. OnTouchListener (){
@ Override www.2cto.com
Public boolean onTouch (View v, MotionEvent event ){
// TODO Auto-generated method stub
LeftPanel. getGestureDetector (). onTouchEvent (event); // you need to write it like this!
Return false;
}
});
ListView. setOnItemClickListener (new ListView. OnItemClickListener (){
@ Override
Public void onItemClick (AdapterView <?> Parent, View view,
Int position, long id ){
// TODO Auto-generated method stub
Log. I ("tag", "position =" + position );
}
});
Because my gesture is defined in the leftPanel View, it is leftPanel. getGestureDetector (). onTouchEvent (event );. If your gesture is written in Activity, it is mGestureDetector. onTouchEvent (event );
In this way, both the drag and the Item Click on the ListView can be ensured.