android.view.MotionEvent.getHistoricalSize()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(199)

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

MotionEvent.getHistoricalSize介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

.of(other.getHistoricalPressure(i));
check("getHistoricalSize(%s)", i)
  .that(actual().getHistoricalSize(i))
  .isWithin(tolerance)
  .of(other.getHistoricalSize(i));
check("getHistoricalTouchMajor(%s)", i)
  .that(actual().getHistoricalTouchMajor(i))

代码示例来源:origin: stackoverflow.com

@Override public boolean onTouchEvent(MotionEvent event) {
   int action = event.getAction();
   mCurDown = action == MotionEvent.ACTION_DOWN
       || action == MotionEvent.ACTION_MOVE;
   int N = event.getHistorySize();
   for (int i=0; i<N; i++) {
     drawPoint(event.getHistoricalX(i), event.getHistoricalY(i),
         event.getHistoricalPressure(i),
         event.getHistoricalSize(i));
   }
   drawPoint(event.getX(), event.getY(), event.getPressure(),
       event.getSize());
   return true;
 }
 private void drawPoint(float x, float y, float pressure, float size) {
   mCurX = (int)x;
   mCurY = (int)y;
   mCurPressure = pressure;
   mCurSize = size;
   mCurWidth = (int)(mCurSize*(getWidth()/3));
   if (mCurWidth < 1) mCurWidth = 1;
   if (mCurDown && mBitmap != null) {
     int pressureLevel = (int)(mCurPressure*255);
     mPaint.setARGB(pressureLevel, 255, 255, 255);
     mCanvas.drawCircle(mCurX, mCurY, mCurWidth, mPaint);
     mRect.set(mCurX-mCurWidth-2, mCurY-mCurWidth-2,
         mCurX+mCurWidth+2, mCurY+mCurWidth+2);
     invalidate(mRect);
   }
 }

代码示例来源:origin: stackoverflow.com

event.getHistoricalSize(i));

相关文章