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

x33g5p2x  于2022-01-29 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(238)

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

ScrollView.onTouchEvent介绍

暂无

代码示例

代码示例来源:origin: ZieIony/Carbon

@Override
public boolean onTouchEvent(@NonNull MotionEvent ev) {
  try {
    return super.onTouchEvent(ev);
  } catch (IllegalArgumentException e) {  // pointer index out of range, see: http://stackoverflow.com/questions/16459196/java-lang-illegalargumentexception-pointerindex-out-of-range-exception-dispat/
    return true;
  }
}

代码示例来源:origin: bluejamesbond/TextJustify-Android

@Override
public boolean onTouchEvent(MotionEvent ev) {
  requestDisallowInterceptTouchEvent(disallowInterceptTouch);
  return super.onTouchEvent(ev);
}

代码示例来源:origin: navasmdc/MaterialDesignLibrary

@Override
  public boolean onTouchEvent(MotionEvent ev) {
//        if(!onInterceptTouchEvent(ev)){
      for(int i = 0; i < ((ViewGroup)getChildAt(0)).getChildCount(); i++){
        try {
          CustomView child =(CustomView) ((ViewGroup)getChildAt(0)).getChildAt(i);
          if(child.isLastTouch){
            child.onTouchEvent(ev);
            return true;
          }
        } catch (ClassCastException e) {
        }
      }
//        }
    return super.onTouchEvent(ev);
  }

代码示例来源: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: jdsjlzx/LRecyclerView

return super.onTouchEvent(ev);

代码示例来源:origin: xmuSistone/VerticalSlideFragment

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (scrollMode == TOUCH_DRAG_LAYOUT) {
    return false;
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: chaychan/TouTiao

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (mHeaderView == null)
    return super.onTouchEvent(ev);
  switch (ev.getAction()) {
    case MotionEvent.ACTION_MOVE:
      if (!mIsPulling) {
        //第一次下拉
        if (getScrollY() == 0) {
          //在顶部的时候,记录顶部位置
          mLastY = (int) ev.getY();
        } else {
          break;
        }
      }
      if(ev.getY()-mLastY<0)
        return super.onTouchEvent(ev);
      int distance = (int) ((ev.getY() - mLastY) * mScaleRatio);
      mIsPulling = true;
      setZoom(distance);
      return true;
    case MotionEvent.ACTION_UP:
      mIsPulling = false;
      replyView();
      break;
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: fossasia/pslab-android

@Override
  public boolean onTouchEvent(MotionEvent event) {
    View view = (View) getChildAt(getChildCount() - 1);
    int diff = (view.getBottom() - (getHeight() + getScrollY()));

    if (event.getAction() == MotionEvent.ACTION_DOWN) {
      if (diff == 0) {
        return false;
      }
    }
    return super.onTouchEvent(event);
  }
}

代码示例来源:origin: weexteam/weex-hackernews

boolean result = super.onTouchEvent(ev);
if (wxGesture != null) {
 result |= wxGesture.onTouch(this, ev);

代码示例来源:origin: xiaoxiangyeyuHeaven/HeavenlyModule

/***
 * 监听touch
 */
@Override
public boolean onTouchEvent(MotionEvent ev) {
  return super.onTouchEvent(ev);
}

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

@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (inner == null) {
    return super.onTouchEvent(ev);
  } else {
    commOnTouchEvent(ev);
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: mnnyang/ClassSchedule

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_UP) {
    startScrollerTask();
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: quaap/LaunchTime

@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
  //Log.d(TAG, "onTouchEvent");
  boolean isLRSwipe = shouldSwipe(motionEvent);
  return isLRSwipe || super.onTouchEvent(motionEvent);
}

代码示例来源:origin: leftcoding/GankLy

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_UP) {
    startScrollerTask();
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: RuZhan/LayerPagerDemo

@Override public boolean onTouchEvent(MotionEvent ev) {
 //body布局隐藏不处理
 if (mBodyLayout.getCurrentState() == LayerLinearLayout.STATE_DOWN) {
  return false;
 }
 return super.onTouchEvent(ev);
}

代码示例来源:origin: ahmclishihao/gankS

@Override
  public boolean onTouchEvent(MotionEvent ev) {
    // 松开手指后子控件回到原位
    if (ev.getAction() == MotionEvent.ACTION_UP) {
      mChild.animate().translationY(0).start();
    }
    return super.onTouchEvent(ev);
  }
}

代码示例来源:origin: JmStefanAndroid/PVCloudGroupn

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (null != mChildRootView) {
    doTouchEvent(ev);
  }
  return super.onTouchEvent(ev);
}

代码示例来源:origin: WiInputMethod/VE

@Override
  public boolean onTouch(View v, MotionEvent event) {
    onScrollOnTouchEvent(v, event);
    return scrollView.onTouchEvent(event);
  }
};

代码示例来源:origin: ImmortalZ/jellyball

@Override
public boolean onTouchEvent(MotionEvent ev) {
  if (mContentView != null) {
    doTouchEvent(ev);
  }
  // 禁止控件本身的滑动.
  return mEnableTouch || super.onTouchEvent(ev);
}

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

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

相关文章

ScrollView类方法