1

A ListView that I have setting the onTouchListener to implementate the item swipe function, and I still need the onItemClick and the onItemLongClick event, but I can't do it.

while I do noting int the onTouch function, and return false, the onItemClick or the longClick will response.the code like this:

public boolean onTouch(View v, MotionEvent event) {
    return false
}

But when I have done something and then at the Action_Up I return it false, the click event no response.somting like that:

public boolean onTouch(View v, MotionEvent event) {
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            // Todo something
            break;
        case MotionEvent.ACTION_MOVE:
            // Todo something
            break;
        case MotionEvent.ACTION_UP:
            // Todo something
            if (the Condition) {
                return true;
            } else {
                return false;
            }
            break;

        default:
            break;
        }
        return true;
    }

I don't know why. I have search this for few days, and until now I still don't know how to do it.Please help me.

naiyu
  • 745
  • 3
  • 9
  • 25

1 Answers1

-1

I have found the way. By the way, there are many libs to do this.

naiyu
  • 745
  • 3
  • 9
  • 25