android.widget.ListView.dispatchTouchEvent()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中android.widget.ListView.dispatchTouchEvent()方法的一些代码示例,展示了ListView.dispatchTouchEvent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.dispatchTouchEvent()方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:dispatchTouchEvent

ListView.dispatchTouchEvent介绍

暂无

代码示例

代码示例来源:origin: Ramotion/expanding-collection-android

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  final int actionMasked = ev.getActionMasked() & MotionEvent.ACTION_MASK;
  // Ignore move events if scroll disabled
  if (scrollDisabled && actionMasked == MotionEvent.ACTION_MOVE) {
    return true;
  }
  // Ignore scroll events if scroll disabled
  if (scrollDisabled && actionMasked == MotionEvent.ACTION_SCROLL) {
    return true;
  }
  // Save the event initial position
  if (actionMasked == MotionEvent.ACTION_DOWN) {
    mPosition = pointToPosition((int) ev.getX(), (int) ev.getY());
    return super.dispatchTouchEvent(ev);
  }
  // Check if we are still in the same position, otherwise cancel event
  int eventPosition = pointToPosition((int) ev.getX(), (int) ev.getY());
  if (actionMasked == MotionEvent.ACTION_UP) {
    if (eventPosition != mPosition) {
      ev.setAction(MotionEvent.ACTION_CANCEL);
    }
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: beworker/pinned-section-listview

super.dispatchTouchEvent(ev);
    performPinnedItemClick();
    clearTouchTarget();
      super.dispatchTouchEvent(mDownEvent);
      super.dispatchTouchEvent(ev);
      clearTouchTarget();
return super.dispatchTouchEvent(ev);

代码示例来源:origin: tianshaojie/AndroidFine

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: huxq17/XRefreshView

return super.dispatchTouchEvent(event);
      return super.dispatchTouchEvent(event);
return super.dispatchTouchEvent(event);

代码示例来源:origin: MiEcosystem/mijiaSDK

@Override
  public boolean dispatchTouchEvent(final MotionEvent ev) {
    try {
      return super.dispatchTouchEvent(ev);
    } catch (final ArrayIndexOutOfBoundsException e) {
      // ignore;
      return false;
    } catch (final IndexOutOfBoundsException e) {
      // ignore;
      return false;
    }
  }
}

代码示例来源:origin: jinguangyue/Android-CustomCamera

public boolean dispatchTouchEvent(MotionEvent ev) {
    if(ev.getAction() == MotionEvent.ACTION_MOVE){
      return true;//禁止Gridview进行滑动
    }
    return super.dispatchTouchEvent(ev);
  }
}

代码示例来源:origin: andforce/iBeebo

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  switch (event.getActionMasked()) {
    case MotionEvent.ACTION_DOWN:
      boolean result = super.dispatchTouchEvent(event);
      if (result) {
        inTouch = true;
      }
      return result;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
      inTouch = false;
      break;
  }
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: luhaoaimama1/zone-sdk

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  switch (ev.getAction()) {
  case MotionEvent.ACTION_DOWN :
    Log.i(TAG, "dispatchTouchEvent ACTION_DOWN");
    break;
  case MotionEvent.ACTION_MOVE:
    Log.i(TAG, "dispatchTouchEvent ACTION_MOVE");
    break;
  case MotionEvent.ACTION_UP:
    break;
  default:
    break;
  }
  return super.dispatchTouchEvent(ev);
}
@Override

代码示例来源:origin: gdpancheng/LoonAndroid3

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it when using Header/Footer Views and the list is empty. This masks the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: TUBB/SwipeMenu

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  return mHelper.handleDispatchTouchEvent(ev) || super.dispatchTouchEvent(ev);
}

代码示例来源:origin: shanyao0/SimpleApp

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: alienjun/AJWaveRefreshForAndroid

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: open-android/PullToRefresh

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: AndroidHensen/YaNi

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: myxh/CoolShopping

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: kaku2015/WeatherAlarmClock

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: Uphie/ONE-Unofficial

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: huangfangyi/FanXin

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  /**
   * This is a bit hacky, but Samsung's ListView has got a bug in it
   * when using Header/Footer Views and the list is empty. This masks
   * the issue so that it doesn't cause an FC. See Issue #66.
   */
  try {
    return super.dispatchTouchEvent(ev);
  } catch (IndexOutOfBoundsException e) {
    e.printStackTrace();
    return false;
  }
}

代码示例来源:origin: mtotschnig/MyExpenses

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (mStickyRect.contains(ev.getX(), ev.getY())) {
    ev.offsetLocation(-mStickyRect.left, -mStickyRect.top);
    return mStickyContainer.dispatchTouchEvent(ev);
  } else {
    return super.dispatchTouchEvent(ev);
  }
}

相关文章

ListView类方法