I have a ListView and I created a custom gesture listener to handle fling touches. I had to override onSingleTapConfirmed to let the listener handle the item touch as well. Unfortunately, if I touch an item, it gets highlighted but doesn't get pushed.
I use the following code in the activity:
ListView listView=(ListView)findViewById(android.R.id.list); final GestureDetector gestureDetector = new GestureDetector(new CustomGestureListener(this)); if (listView != null) listView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (gestureDetector.onTouchEvent(event)) { return false; } return true; } }); In the CustomGestureListener:
@Override public boolean onSingleTapConfirmed(MotionEvent event) { ListView listView=(ListView)((InfoActivity)context).findViewById(android.R.id.list); listView.onTouchEvent(event); return super.onSingleTapUp(event); } Also, If I use scroll like this, there is no scroll:
@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return super.onScroll(e1,e2,distanceX,distanceY); } What should I set to let my listview items get clicked, get scrolled and let fling work, too?