Android Question trapping swipe events on top of click events

Discussion in 'Android Questions' started by sorex, Jul 1, 2015.

  1. sorex

    sorex Expert Licensed User


    When you have a panel with labels/buttons in it that have their own click event how would you trap a swipe event that happends above the label/button?

    I could add it to each panel where the labels/buttons are in but that's kind of a nasty workaround.

    How would you solved it?
  2. Cableguy

    Cableguy Expert Licensed User

    Detect the touch_down and touch_up events, if the distance (x,y coordinate) aren't too wide, its a touch, so ignore, if the distance is big, its a swipe, act on it
  3. sorex

    sorex Expert Licensed User

    I know that and I added it to the button panels like that.

    It works fine but I wondered if there was another method.
  4. Erel

    Erel Administrator Staff Member Licensed User