android.widget.GridView.onTouchEvent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(152)

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

GridView.onTouchEvent介绍

暂无

代码示例

代码示例来源:origin: TommyLemon/APIJSON

@SuppressLint("ClickableViewAccessibility")
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    if (!isEnabled()) {
      // A disabled view that is clickable still consumes the touch
      // events, it just doesn't respond to them.
      return isClickable() || isLongClickable();
    }

    final int motionPosition = pointToPosition((int)event.getX(), (int)event.getY());//获取点击的位置
    if(motionPosition == INVALID_POSITION) {//touch事件转交给后面的View处理
      super.onTouchEvent(event);
      return false;
    }
    return super.onTouchEvent(event);
  }
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (hasNoCallbacks()) {
    return super.onTouchEvent(ev);
        return super.onTouchEvent(ev);
  return super.onTouchEvent(ev);

代码示例来源:origin: TonicArtos/StickyGridHeaders

return true;
return super.onTouchEvent(ev);

代码示例来源:origin: UweTrottmann/SeriesGuide

return true;
return super.onTouchEvent(ev);

代码示例来源:origin: com.albedinsky.android/ui-widget-collection

/**
 */
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
  this.ensureDecorator();
  return mDecorator.onTouchEvent(event) || super.onTouchEvent(event);
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 */
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
  this.ensureDecorator();
  return mDecorator.onTouchEvent(event) || super.onTouchEvent(event);
}

代码示例来源:origin: yuqirong/DragGridView

@Override
public boolean onTouchEvent(MotionEvent ev) {
  switch (ev.getAction()) {
    case MotionEvent.ACTION_DOWN:
      break;
    case MotionEvent.ACTION_MOVE:
      if (mode == MODE_DRAG) {
        updateWindow(ev);
      }
      break;
    case MotionEvent.ACTION_UP:
      if (mode == MODE_DRAG) {
        closeWindow(ev.getX(), ev.getY());
      }
      break;
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: ApolloAuto/apollo-DuerOS

@Override
  public boolean onTouchEvent(MotionEvent event) {

    if (event.getAction() == MotionEvent.ACTION_UP) {
      if (mTouchInvalidPosListener == null) {
        return super.onTouchEvent(event);
      }

      if (!isEnabled()) {
        // A disabled view that is clickable still consumes the touch
        // events, it just doesn't respond to them.
        return isClickable() || isLongClickable();
      }

      final int motionPosition = pointToPosition((int) event.getX(), (int) event.getY());
      if (motionPosition == INVALID_POSITION) {
        super.onTouchEvent(event);
        return mTouchInvalidPosListener.onTouchInvalidPosition(event.getActionMasked());
      }
    }

    return super.onTouchEvent(event);
  }
}

代码示例来源:origin: whatshappen/TopGrid

if (dragImageView != null && dragPosition != AdapterView.INVALID_POSITION) {
  bool = super.onTouchEvent(ev);
  int x = (int) ev.getX();
  int y = (int) ev.getY();
return super.onTouchEvent(ev);

代码示例来源:origin: kymjs/Modularity

return super.onTouchEvent(ev);

代码示例来源:origin: 6ag/BaoKanAndroid

return super.onTouchEvent(ev);

代码示例来源:origin: julesbond007/android-jigsaw-puzzle

return super.onTouchEvent(event);

代码示例来源:origin: macdidi5/Android-Things-Tutorial

return super.onTouchEvent(event);

代码示例来源:origin: canqihe/TmallSale

return super.onTouchEvent(ev);

相关文章

GridView类方法