快速滑动TouchEvent.ACTION_MOVE缺少Y坐标和X坐标

时间:2012-03-15 07:31:09

标签: android continuous touch-event

我的这个问题与我之前的here有点相关......我在TouchEvent.ACTION_MOVE上得到X和Y值。如果我慢慢地移动我的手指,它工作正常但是如果我快速移动我的手指就错过了X和Y坐标我已经使用了历史事件但仍然没有用..我想要连续的X和Y值没有任何跳跃

示例代码

void printSamples(MotionEvent ev, RectangleParticleEmitter ps) {

    final int historySize = ev.getHistorySize();
    final int pointerCount = ev.getPointerCount();

     for (int h = 0; h < historySize; h++) {

         System.out.println("At time "+ ev.getHistoricalEventTime(h));

         for (int p = 0; p < pointerCount; p++) {


             System.out.println("****************************************");
             System.out.println("Pointer Count "+pointerCount);
             System.out.println("Pointer "+ev.getPointerId(p));
             System.out.println("Historical X "+ev.getHistoricalX(p, h));

             System.out.println("Historical Y "+ev.getHistoricalY(p, h));                
             System.out.println("****************************************");



             ps.setCenter(ev.getHistoricalX(p), ev.getHistoricalY(p));
         }
     }

     System.out.printf("At time %d:", ev.getEventTime());

     for (int p = 0; p < pointerCount; p++) {


         System.out.println("#######################################");
         System.out.println("Pointer ID "+ev.getPointerId(p));
         System.out.println("Pointer X "+ev.getX(p));
         System.out.println("Pointer Y "+ev.getY(p));
         System.out.println("#######################################");

     }
 }
  

LOG

 03-15 07:41:17.570: I/System.out(2877): At time 12650702
03-15 07:41:17.570: I/System.out(2877): ****************************************
03-15 07:41:17.570: I/System.out(2877): Pointer Count 1
03-15 07:41:17.570: I/System.out(2877): Pointer 0
03-15 07:41:17.570: I/System.out(2877): Historical X 21.441616
03-15 07:41:17.570: I/System.out(2877): Historical Y 416.5561
03-15 07:41:17.570: I/System.out(2877): ****************************************
03-15 07:41:17.570: I/System.out(2877): At time 12650716:#######################################
03-15 07:41:17.570: I/System.out(2877): Pointer ID 0
03-15 07:41:17.580: I/System.out(2877): Pointer X 26.729622
03-15 07:41:17.580: I/System.out(2877): Pointer Y 412.76462
03-15 07:41:17.580: I/System.out(2877): #######################################
03-15 07:41:17.600: I/System.out(2877): At time 12650725
03-15 07:41:17.600: I/System.out(2877): ****************************************
03-15 07:41:17.610: I/System.out(2877): Pointer Count 1
03-15 07:41:17.610: I/System.out(2877): Pointer 0
03-15 07:41:17.610: I/System.out(2877): Historical X 38.56469
03-15 07:41:17.610: I/System.out(2877): Historical Y 405.6872
03-15 07:41:17.610: I/System.out(2877): ****************************************
03-15 07:41:17.610: I/System.out(2877): At time 12650745:#######################################
03-15 07:41:17.610: I/System.out(2877): Pointer ID 0
03-15 07:41:17.610: I/System.out(2877): Pointer X 55.56185
03-15 07:41:17.610: I/System.out(2877): Pointer Y 393.93365
03-15 07:41:17.610: I/System.out(2877): #######################################
03-15 07:41:17.640: I/System.out(2877): At time 12650751
03-15 07:41:17.640: I/System.out(2877): ****************************************
03-15 07:41:17.640: I/System.out(2877): Pointer Count 1
03-15 07:41:17.640: I/System.out(2877): Pointer 0
03-15 07:41:17.640: I/System.out(2877): Historical X 79.86151
03-15 07:41:17.640: I/System.out(2877): Historical Y 378.89417
03-15 07:41:17.640: I/System.out(2877): ****************************************
03-15 07:41:17.640: I/System.out(2877): At time 12650760
03-15 07:41:17.640: I/System.out(2877): ****************************************
03-15 07:41:17.640: I/System.out(2877): Pointer Count 1
03-15 07:41:17.640: I/System.out(2877): Pointer 0
03-15 07:41:17.640: I/System.out(2877): Historical X 111.46365
03-15 07:41:17.640: I/System.out(2877): Historical Y 359.43127
03-15 07:41:17.640: I/System.out(2877): ****************************************
03-15 07:41:17.640: I/System.out(2877): At time 12650774:#######################################
03-15 07:41:17.640: I/System.out(2877): Pointer ID 0
03-15 07:41:17.640: I/System.out(2877): Pointer X 151.1237
03-15 07:41:17.640: I/System.out(2877): Pointer Y 336.3033
03-15 07:41:17.640: I/System.out(2877): #######################################
03-15 07:41:17.670: I/System.out(2877): At time 12650786
03-15 07:41:17.670: I/System.out(2877): ****************************************
03-15 07:41:17.670: I/System.out(2877): Pointer Count 1
03-15 07:41:17.670: I/System.out(2877): Pointer 0
03-15 07:41:17.670: I/System.out(2877): Historical X 199.09349
03-15 07:41:17.670: I/System.out(2877): Historical Y 308.4992
03-15 07:41:17.670: I/System.out(2877): ****************************************
03-15 07:41:17.670: I/System.out(2877): At time 12650794:#######################################
03-15 07:41:17.670: I/System.out(2877): Pointer ID 0
03-15 07:41:17.670: I/System.out(2877): Pointer X 251.84766
03-15 07:41:17.670: I/System.out(2877): Pointer Y 279.93683
03-15 07:41:17.670: I/System.out(2877): #######################################
03-15 07:41:17.690: I/System.out(2877): At time 12650812
03-15 07:41:17.690: I/System.out(2877): ****************************************
03-15 07:41:17.690: I/System.out(2877): Pointer Count 1
03-15 07:41:17.690: I/System.out(2877): Pointer 0
03-15 07:41:17.690: I/System.out(2877): Historical X 309.51215
03-15 07:41:17.690: I/System.out(2877): Historical Y 248.97314
03-15 07:41:17.690: I/System.out(2877): ****************************************
03-15 07:41:17.690: I/System.out(2877): At time 12650818
03-15 07:41:17.690: I/System.out(2877): ****************************************
03-15 07:41:17.690: I/System.out(2877): Pointer Count 1
03-15 07:41:17.690: I/System.out(2877): Pointer 0
03-15 07:41:17.690: I/System.out(2877): Historical X 371.33145
03-15 07:41:17.690: I/System.out(2877): Historical Y 218.51501
03-15 07:41:17.690: I/System.out(2877): ****************************************
03-15 07:41:17.690: I/System.out(2877): At time 12650832:#######################################
03-15 07:41:17.690: I/System.out(2877): Pointer ID 0
03-15 07:41:17.690: I/System.out(2877): Pointer X 431.89175
03-15 07:41:17.690: I/System.out(2877): Pointer Y 189.06793
03-15 07:41:17.690: I/System.out(2877): #######################################
03-15 07:41:17.710: I/System.out(2877): At time 12650840
03-15 07:41:17.710: I/System.out(2877): ****************************************
03-15 07:41:17.710: I/System.out(2877): Pointer Count 1
03-15 07:41:17.710: I/System.out(2877): Pointer 0
03-15 07:41:17.710: I/System.out(2877): Historical X 492.2002
03-15 07:41:17.710: I/System.out(2877): Historical Y 159.2417
03-15 07:41:17.710: I/System.out(2877): ****************************************
03-15 07:41:17.710: I/System.out(2877): At time 12650856:#######################################
03-15 07:41:17.710: I/System.out(2877): Pointer ID 0
03-15 07:41:17.710: I/System.out(2877): Pointer X 550.87195
03-15 07:41:17.710: I/System.out(2877): Pointer Y 132.32227
03-15 07:41:17.710: I/System.out(2877): #######################################
03-15 07:41:17.730: I/System.out(2877): At time 12650869:#######################################
03-15 07:41:17.730: I/System.out(2877): Pointer ID 0
03-15 07:41:17.730: I/System.out(2877): Pointer X 607.1514
03-15 07:41:17.730: I/System.out(2877): Pointer Y 106.03476
03-15 07:41:17.730: I/System.out(2877): #######################################

0 个答案:

没有答案