我们给viewpager设置监听的时候,对于这个地方的几个函数,我总是记不太清楚,今天就好好整理整理。
[java] view plaincopyprint?vp.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
System.out.println("onpageselect = " + arg0);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
System.out.println("onPageScrolled = " + arg0 + ", " + arg1 + ", " + arg2);
}
@Override
public void onPageScrollStateChanged(int arg0) {
System.out.println("onPageScrollStateChanged = " + arg0);
}
});
vp.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
System.out.println("onpageselect = " + arg0);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
System.out.println("onPageScrolled = " + arg0 + ", " + arg1 + ", " + arg2);
}
@Override
public void onPageScrollStateChanged(int arg0) {
System.out.println("onPageScrollStateChanged = " + arg0);
}
});
大概先解释一下上面几个函数中各个参数的含义:
1.onPageSelected(int arg0) 指的是当前选择的是哪个页面
2. onPageScrolled(int arg0, float arg1, int arg2) arg0表示目标,arg1表示偏移的百分比,arg2表示偏移的像素
3. onPageScrollStateChanged(int arg0) 表示当前滑动的状态,只有三个状态0, 1, 2,下面我们结合打印的日志来具体看看他们的含义
下面是正常的向右滑动(6->7)的打印日志
[java] view plaincopyprint?01-03 06:35:27.142: I/System.out(27590): onPageScrollStateChanged = 1
01-03 06:35:27.142: I/System.out(27590): onPageScrollStateChanged = 1[java] view plaincopyprint?01-03 06:35:27.143: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:35:27.160: I/System.out(27590): onPageScrolled = 6, 0.0333333, 15
01-03 06:35:27.179: I/System.out(27590): onPageScrolled = 6, 0.08958328, 42
01-03 06:35:27.200: I/System.out(27590): onPageScrolled = 6, 0.14374995, 68
01-03 06:35:27.215: I/System.out(27590): onPageScrolled = 6, 0.19791663, 94
01-03 06:35:27.232: I/System.out(27590): onPageScrolled = 6, 0.21875, 105
01-03 06:35:27.143: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:35:27.160: I/System.out(27590): onPageScrolled = 6, 0.0333333, 15
01-03 06:35:27.179: I/System.out(27590): onPageScrolled = 6, 0.08958328, 42
01-03 06:35:27.200: I/System.out(27590): onPageScrolled = 6, 0.14374995, 68
01-03 06:35:27.215: I/System.out(27590): onPageScrolled = 6, 0.19791663, 94
01-03 06:35:27.232: I/System.out(27590): onPageScrolled = 6, 0.21875, 105[java] view plaincopyprint?01-03 06:35:27.253: I/System.out(27590): onPageScrollStateChanged = 2
01-03 06:35:27.254: I/System.out(27590): onpageselect = 7
01-03 06:35:27.253: I/System.out(27590): onPageScrollStateChanged = 2
01-03 06:35:27.254: I/System.out(27590): onpageselect = 7[java] view plaincopyprint?01-03 06:35:27.265: I/System.out(27590): onPageScrolled = 6, 0.2833333, 135
01-03 06:35:27.267: I/System.out(27590): onPageScrolled = 6, 0.30208337, 145
01-03 06:35:27.276: I/System.out(27590): onPageScrolled = 6, 0.35208333, 169
01-03 06:35:27.276: I/System.out(27590): onPageScrolled = 6, 0.35625005, 171
01-03 06:35:27.294: I/System.out(27590): onPageScrolled = 6, 0.45000005, 216
01-03 06:35:27.294: I/System.out(27590): onPageScrolled = 6, 0.45416665, 218
01-03 06:35:27.312: I/System.out(27590): onPageScrolled = 6, 0.5354167, 257
01-03 06:35:27.312: I/System.out(27590): onPageScrolled = 6, 0.5395833, 259
01-03 06:35:27.329: I/System.out(27590): onPageScrolled = 6, 0.61041665, 293
01-03 06:35:27.347: I/System.out(27590): onPageScrolled = 6, 0.67291665, 323
01-03 06:35:27.347: I/System.out(27590): onPageScrolled = 6, 0.6770834, 325
01-03 06:35:27.365: I/System.out(27590): onPageScrolled = 6, 0.7291666, 349
01-03 06:35:27.365: I/System.out(27590): onPageScrolled = 6, 0.73125005, 351
01-03 06:35:27.382: I/System.out(27590): onPageScrolled = 6, 0.7770833, 372
01-03 06:35:27.400: I/System.out(27590): onPageScrolled = 6, 0.8166667, 392
01-03 06:35:27.400: I/System.out(27590): onPageScrolled = 6, 0.81875, 393
01-03 06:35:27.418: I/System.out(27590): onPageScrolled = 6, 0.8541666, 409
01-03 06:35:27.435: I/System.out(27590): onPageScrolled = 6, 0.88125, 423
01-03 06:35:27.453: I/System.out(27590): onPageScrolled = 6, 0.90625, 435
01-03 06:35:27.471: I/System.out(27590): onPageScrolled = 6, 0.92499995, 443
01-03 06:35:27.471: I/System.out(27590): onPageScrolled = 6, 0.9270834, 445
01-03 06:35:27.489: I/System.out(27590): onPageScrolled = 6, 0.9416667, 452
01-03 06:35:27.489: I/System.out(27590): onPageScrolled = 6, 0.94375, 453
01-03 06:35:27.506: I/System.out(27590): onPageScrolled = 6, 0.95624995, 458
01-03 06:35:27.524: I/System.out(27590): onPageScrolled = 6, 0.9666667, 464
01-03 06:35:27.542: I/System.out(27590): onPageScrolled = 6, 0.975, 468
01-03 06:35:27.559: I/System.out(27590): onPageScrolled = 6, 0.98125005, 471
01-03 06:35:27.577: I/System.out(27590): onPageScrolled = 6, 0.98749995, 473
01-03 06:35:27.595: I/System.out(27590): onPageScrolled = 6, 0.9916667, 476
01-03 06:35:27.612: I/System.out(27590): onPageScrolled = 6, 0.99375, 477
01-03 06:35:27.630: I/System.out(27590): onPageScrolled = 6, 0.9958333, 477
01-03 06:35:27.648: I/System.out(27590): onPageScrolled = 6, 0.9979167, 479
01-03 06:35:27.684: I/System.out(27590): onPageScrolled = 7, 0.0, 0
01-03 06:35:27.265: I/System.out(27590): onPageScrolled = 6, 0.2833333, 135
01-03 06:35:27.267: I/System.out(27590): onPageScrolled = 6, 0.30208337, 145
01-03 06:35:27.276: I/System.out(27590): onPageScrolled = 6, 0.35208333, 169
01-03 06:35:27.276: I/System.out(27590): onPageScrolled = 6, 0.35625005, 171
01-03 06:35:27.294: I/System.out(27590): onPageScrolled = 6, 0.45000005, 216
01-03 06:35:27.294: I/System.out(27590): onPageScrolled = 6, 0.45416665, 218
01-03 06:35:27.312: I/System.out(27590): onPageScrolled = 6, 0.5354167, 257
01-03 06:35:27.312: I/System.out(27590): onPageScrolled = 6, 0.5395833, 259
01-03 06:35:27.329: I/System.out(27590): onPageScrolled = 6, 0.61041665, 293
01-03 06:35:27.347: I/System.out(27590): onPageScrolled = 6, 0.67291665, 323
01-03 06:35:27.347: I/System.out(27590): onPageScrolled = 6, 0.6770834, 325
01-03 06:35:27.365: I/System.out(27590): onPageScrolled = 6, 0.7291666, 349
01-03 06:35:27.365: I/System.out(27590): onPageScrolled = 6, 0.73125005, 351
01-03 06:35:27.382: I/System.out(27590): onPageScrolled = 6, 0.7770833, 372
01-03 06:35:27.400: I/System.out(27590): onPageScrolled = 6, 0.8166667, 392
01-03 06:35:27.400: I/System.out(27590): onPageScrolled = 6, 0.81875, 393
01-03 06:35:27.418: I/System.out(27590): onPageScrolled = 6, 0.8541666, 409
01-03 06:35:27.435: I/System.out(27590): onPageScrolled = 6, 0.88125, 423
01-03 06:35:27.453: I/System.out(27590): onPageScrolled = 6, 0.90625, 435
01-03 06:35:27.471: I/System.out(27590): onPageScrolled = 6, 0.92499995, 443
01-03 06:35:27.471: I/System.out(27590): onPageScrolled = 6, 0.9270834, 445
01-03 06:35:27.489: I/System.out(27590): onPageScrolled = 6, 0.9416667, 452
01-03 06:35:27.489: I/System.out(27590): onPageScrolled = 6, 0.94375, 453
01-03 06:35:27.506: I/System.out(27590): onPageScrolled = 6, 0.95624995, 458
01-03 06:35:27.524: I/System.out(27590): onPageScrolled = 6, 0.9666667, 464
01-03 06:35:27.542: I/System.out(27590): onPageScrolled = 6, 0.975, 468
01-03 06:35:27.559: I/System.out(27590): onPageScrolled = 6, 0.98125005, 471
01-03 06:35:27.577: I/System.out(27590): onPageScrolled = 6, 0.98749995, 473
01-03 06:35:27.595: I/System.out(27590): onPageScrolled = 6, 0.9916667, 476
01-03 06:35:27.612: I/System.out(27590): onPageScrolled = 6, 0.99375, 477
01-03 06:35:27.630: I/System.out(27590): onPageScrolled = 6, 0.9958333, 477
01-03 06:35:27.648: I/System.out(27590): onPageScrolled = 6, 0.9979167, 479
01-03 06:35:27.684: I/System.out(27590): onPageScrolled = 7, 0.0, 0[java] view plaincopyprint?01-03 06:35:27.877: I/System.out(27590): onPageScrollStateChanged = 0
01-03 06:35:27.877: I/System.out(27590): onPageScrollStateChanged = 0
下面是正常的向左滑动(7->6)的日志:
[java] view plaincopyprint?01-03 06:49:37.677: I/System.out(27590): onPageScrollStateChanged = 1
01-03 06:49:37.677: I/System.out(27590): onPageScrollStateChanged = 1[java] view plaincopyprint?01-03 06:49:37.678: I/System.out(27590): onPageScrolled = 6, 0.9458333, 454
01-03 06:49:37.695: I/System.out(27590): onPageScrolled = 6, 0.92291665, 443
01-03 06:49:37.714: I/System.out(27590): onPageScrolled = 6, 0.8708333, 417
01-03 06:49:37.735: I/System.out(27590): onPageScrolled = 6, 0.84375, 405
01-03 06:49:37.751: I/System.out(27590): onPageScrolled = 6, 0.7875, 378
01-03 06:49:37.767: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:49:37.787: I/System.out(27590): onPageScrolled = 6, 0.70416665, 338
01-03 06:49:37.678: I/System.out(27590): onPageScrolled = 6, 0.9458333, 454
01-03 06:49:37.695: I/System.out(27590): onPageScrolled = 6, 0.92291665, 443
01-03 06:49:37.714: I/System.out(27590): onPageScrolled = 6, 0.8708333, 417
01-03 06:49:37.735: I/System.out(27590): onPageScrolled = 6, 0.84375, 405
01-03 06:49:37.751: I/System.out(27590): onPageScrolled = 6, 0.7875, 378
01-03 06:49:37.767: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:49:37.787: I/System.out(27590): onPageScrolled = 6, 0.70416665, 338[java] view plaincopyprint?01-03 06:49:37.806: I/System.out(27590): onPageScrollStateChanged = 2
01-03 06:49:37.807: I/System.out(27590): onpageselect = 6
01-03 06:49:37.806: I/System.out(27590): onPageScrollStateChanged = 2
01-03 06:49:37.807: I/System.out(27590): onpageselect = 6[java] view plaincopyprint?01-03 06:49:37.817: I/System.out(27590): onPageScrolled = 6, 0.64374995, 308
01-03 06:49:37.819: I/System.out(27590): onPageScrolled = 6, 0.6270833, 301
01-03 06:49:37.820: I/System.out(27590): onPageScrolled = 6, 0.6208333, 297
01-03 06:49:37.826: I/System.out(27590): onPageScrolled = 6, 0.5895833, 282
01-03 06:49:37.858: I/System.out(27590): onPageScrolled = 6, 0.4354167, 209
01-03 06:49:37.876: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:49:37.894: I/System.out(27590): onPageScrolled = 6, 0.30624998, 146
01-03 06:49:37.894: I/System.out(27590): onPageScrolled = 6, 0.30416667, 146
01-03 06:49:37.912: I/System.out(27590): onPageScrolled = 6, 0.25416672, 122
01-03 06:49:37.912: I/System.out(27590): onPageScrolled = 6, 0.25, 120
01-03 06:49:37.929: I/System.out(27590): onPageScrolled = 6, 0.20833337, 100
01-03 06:49:37.947: I/System.out(27590): onPageScrolled = 6, 0.17083335, 82
01-03 06:49:37.947: I/System.out(27590): onPageScrolled = 6, 0.16875005, 81
01-03 06:49:37.965: I/System.out(27590): onPageScrolled = 6, 0.13750005, 66
01-03 06:49:37.965: I/System.out(27590): onPageScrolled = 6, 0.13541663, 64
01-03 06:49:37.982: I/System.out(27590): onPageScrolled = 6, 0.11041665, 52
01-03 06:49:38.000: I/System.out(27590): onPageScrolled = 6, 0.087499976, 41
01-03 06:49:38.018: I/System.out(27590): onPageScrolled = 6, 0.068750024, 33
01-03 06:49:38.036: I/System.out(27590): onPageScrolled = 6, 0.054166675, 26
01-03 06:49:38.036: I/System.out(27590): onPageScrolled = 6, 0.052083373, 25
01-03 06:49:38.053: I/System.out(27590): onPageScrolled = 6, 0.039583325, 18
01-03 06:49:38.071: I/System.out(27590): onPageScrolled = 6, 0.03125, 15
01-03 06:49:38.089: I/System.out(27590): onPageScrolled = 6, 0.022916675, 11
01-03 06:49:38.106: I/System.out(27590): onPageScrolled = 6, 0.01666665, 7
01-03 06:49:38.125: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:49:38.125: I/System.out(27590): onPageScrolled = 6, 0.010416627, 4
01-03 06:49:38.142: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:49:38.160: I/System.out(27590): onPageScrolled = 6, 0.006250024, 3
01-03 06:49:38.177: I/System.out(27590): onPageScrolled = 6, 0.0041667223, 2
01-03 06:49:38.195: I/System.out(27590): onPageScrolled = 6, 0.0020833015, 0
01-03 06:49:38.230: I/System.out(27590): onPageScrolled = 6, 0.0, 0
01-03 06:49:37.817: I/System.out(27590): onPageScrolled = 6, 0.64374995, 308
01-03 06:49:37.819: I/System.out(27590): onPageScrolled = 6, 0.6270833, 301
01-03 06:49:37.820: I/System.out(27590): onPageScrolled = 6, 0.6208333, 297
01-03 06:49:37.826: I/System.out(27590): onPageScrolled = 6, 0.5895833, 282
01-03 06:49:37.858: I/System.out(27590): onPageScrolled = 6, 0.4354167, 209
01-03 06:49:37.876: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:49:37.894: I/System.out(27590): onPageScrolled = 6, 0.30624998, 146
01-03 06:49:37.894: I/System.out(27590): onPageScrolled = 6, 0.30416667, 146
01-03 06:49:37.912: I/System.out(27590): onPageScrolled = 6, 0.25416672, 122
01-03 06:49:37.912: I/System.out(27590): onPageScrolled = 6, 0.25, 120
01-03 06:49:37.929: I/System.out(27590): onPageScrolled = 6, 0.20833337, 100
01-03 06:49:37.947: I/System.out(27590): onPageScrolled = 6, 0.17083335, 82
01-03 06:49:37.947: I/System.out(27590): onPageScrolled = 6, 0.16875005, 81
01-03 06:49:37.965: I/System.out(27590): onPageScrolled = 6, 0.13750005, 66
01-03 06:49:37.965: I/System.out(27590): onPageScrolled = 6, 0.13541663, 64
01-03 06:49:37.982: I/System.out(27590): onPageScrolled = 6, 0.11041665, 52
01-03 06:49:38.000: I/System.out(27590): onPageScrolled = 6, 0.087499976, 41
01-03 06:49:38.018: I/System.out(27590): onPageScrolled = 6, 0.068750024, 33
01-03 06:49:38.036: I/System.out(27590): onPageScrolled = 6, 0.054166675, 26
01-03 06:49:38.036: I/System.out(27590): onPageScrolled = 6, 0.052083373, 25
01-03 06:49:38.053: I/System.out(27590): onPageScrolled = 6, 0.039583325, 18
01-03 06:49:38.071: I/System.out(27590): onPageScrolled = 6, 0.03125, 15
01-03 06:49:38.089: I/System.out(27590): onPageScrolled = 6, 0.022916675, 11
01-03 06:49:38.106: I/System.out(27590): onPageScrolled = 6, 0.01666665, 7
01-03 06:49:38.125: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:49:38.125: I/System.out(27590): onPageScrolled = 6, 0.010416627, 4
01-03 06:49:38.142: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:49:38.160: I/System.out(27590): onPageScrolled = 6, 0.006250024, 3
01-03 06:49:38.177: I/System.out(27590): onPageScrolled = 6, 0.0041667223, 2
01-03 06:49:38.195: I/System.out(27590): onPageScrolled = 6, 0.0020833015, 0
01-03 06:49:38.230: I/System.out(27590): onPageScrolled = 6, 0.0, 0[java] view plaincopyprint?01-03 06:49:38.425: I/System.out(27590): onPageScrollStateChanged = 0
01-03 06:49:38.425: I/System.out(27590): onPageScrollStateChanged = 0
下面是向右滑动,但是不让页面专挑的日志:
[java] view plaincopyprint?01-03 06:50:58.796: I/System.out(27590): onPageScrollStateChanged = 1
01-03 06:50:58.796: I/System.out(27590): onPageScrollStateChanged = 1[java] view plaincopyprint?01-03 06:50:58.796: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:50:58.812: I/System.out(27590): onPageScrolled = 6, 0.027083278, 12
01-03 06:50:58.829: I/System.out(27590): onPageScrolled = 6, 0.04791665, 22
01-03 06:50:58.849: I/System.out(27590): onPageScrolled = 6, 0.070833325, 33
01-03 06:50:58.869: I/System.out(27590): onPageScrolled = 6, 0.0916667, 44
01-03 06:50:58.885: I/System.out(27590): onPageScrolled = 6, 0.11249995, 53
01-03 06:50:58.902: I/System.out(27590): onPageScrolled = 6, 0.13333333, 63
01-03 06:50:58.921: I/System.out(27590): onPageScrolled = 6, 0.15208328, 72
01-03 06:50:58.942: I/System.out(27590): onPageScrolled = 6, 0.17083335, 82
01-03 06:50:58.958: I/System.out(27590): onPageScrolled = 6, 0.1895833, 90
01-03 06:50:58.975: I/System.out(27590): onPageScrolled = 6, 0.20833337, 100
01-03 06:50:58.994: I/System.out(27590): onPageScrolled = 6, 0.22500002, 108
01-03 06:50:59.015: I/System.out(27590): onPageScrolled = 6, 0.23958337, 115
01-03 06:50:59.030: I/System.out(27590): onPageScrolled = 6, 0.25833333, 124
01-03 06:50:59.047: I/System.out(27590): onPageScrolled = 6, 0.27708328, 132
01-03 06:50:59.065: I/System.out(27590): onPageScrolled = 6, 0.29375005, 141
01-03 06:50:59.085: I/System.out(27590): onPageScrolled = 6, 0.3125, 150
01-03 06:50:59.102: I/System.out(27590): onPageScrolled = 6, 0.33124995, 158
01-03 06:50:59.117: I/System.out(27590): onPageScrolled = 6, 0.34791672, 167
01-03 06:50:59.137: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:50:59.158: I/System.out(27590): onPageScrolled = 6, 0.38125002, 183
01-03 06:50:59.174: I/System.out(27590): onPageScrolled = 6, 0.39791667, 191
01-03 06:50:59.190: I/System.out(27590): onPageScrolled = 6, 0.41458333, 199
01-03 06:50:59.210: I/System.out(27590): onPageScrolled = 6, 0.43124998, 206
01-03 06:50:59.230: I/System.out(27590): onPageScrolled = 6, 0.45000005, 216
01-03 06:50:59.246: I/System.out(27590): onPageScrolled = 6, 0.46875, 225
01-03 06:50:59.263: I/System.out(27590): onPageScrolled = 6, 0.48749995, 233
01-03 06:50:59.283: I/System.out(27590): onPageScrolled = 6, 0.5, 240
01-03 06:50:59.303: I/System.out(27590): onPageScrolled = 6, 0.51666665, 248
01-03 06:50:59.319: I/System.out(27590): onPageScrolled = 6, 0.5333333, 255
01-03 06:50:59.335: I/System.out(27590): onPageScrolled = 6, 0.54791665, 263
01-03 06:50:59.354: I/System.out(27590): onPageScrolled = 6, 0.5625, 270
01-03 06:50:59.373: I/System.out(27590): onPageScrolled = 6, 0.57500005, 276
01-03 06:50:59.389: I/System.out(27590): onPageScrolled = 6, 0.57916665, 278
01-03 06:50:59.406: I/System.out(27590): onPageScrolled = 6, 0.5916667, 284
01-03 06:50:59.426: I/System.out(27590): onPageScrolled = 6, 0.5979167, 287
01-03 06:50:59.446: I/System.out(27590): onPageScrolled = 6, 0.61041665, 293
01-03 06:50:59.462: I/System.out(27590): onPageScrolled = 6, 0.6145834, 295
01-03 06:50:59.479: I/System.out(27590): onPageScrolled = 6, 0.6291667, 302
01-03 06:50:59.499: I/System.out(27590): onPageScrolled = 6, 0.64166665, 308
01-03 06:50:59.519: I/System.out(27590): onPageScrolled = 6, 0.6479167, 311
01-03 06:50:59.535: I/System.out(27590): onPageScrolled = 6, 0.6541667, 314
01-03 06:50:59.552: I/System.out(27590): onPageScrolled = 6, 0.6604167, 317
01-03 06:50:59.572: I/System.out(27590): onPageScrolled = 6, 0.6645833, 319
01-03 06:50:59.592: I/System.out(27590): onPageScrolled = 6, 0.67083335, 322
01-03 06:50:59.608: I/System.out(27590): onPageScrolled = 6, 0.67499995, 323
01-03 06:50:59.624: I/System.out(27590): onPageScrolled = 6, 0.68125, 327
01-03 06:50:59.642: I/System.out(27590): onPageScrolled = 6, 0.6875, 330
01-03 06:50:59.662: I/System.out(27590): onPageScrolled = 6, 0.6916667, 332
01-03 06:50:59.678: I/System.out(27590): onPageScrolled = 6, 0.6979166, 334
01-03 06:50:59.695: I/System.out(27590): onPageScrolled = 6, 0.70208335, 337
01-03 06:50:59.714: I/System.out(27590): onPageScrolled = 6, 0.70624995, 338
01-03 06:50:59.735: I/System.out(27590): onPageScrolled = 6, 0.7125, 342
01-03 06:50:59.750: I/System.out(27590): onPageScrolled = 6, 0.7166667, 344
01-03 06:50:59.767: I/System.out(27590): onPageScrolled = 6, 0.7229167, 347
01-03 06:50:59.787: I/System.out(27590): onPageScrolled = 6, 0.7291666, 349
01-03 06:50:59.807: I/System.out(27590): onPageScrolled = 6, 0.73541665, 353
01-03 06:50:59.823: I/System.out(27590): onPageScrolled = 6, 0.7395834, 355
01-03 06:50:59.840: I/System.out(27590): onPageScrolled = 6, 0.74375, 357
01-03 06:50:59.859: I/System.out(27590): onPageScrolled = 6, 0.7479167, 359
01-03 06:50:59.879: I/System.out(27590): onPageScrolled = 6, 0.7520833, 361
01-03 06:50:59.895: I/System.out(27590): onPageScrolled = 6, 0.7541667, 362
01-03 06:50:59.911: I/System.out(27590): onPageScrolled = 6, 0.7583333, 364
01-03 06:50:59.930: I/System.out(27590): onPageScrolled = 6, 0.7604166, 364
01-03 06:50:59.949: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:50:59.965: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:50:59.982: I/System.out(27590): onPageScrolled = 6, 0.76458335, 367
01-03 06:51:00.012: I/System.out(27590): onPageScrolled = 6, 0.76666665, 368
01-03 06:51:00.035: I/System.out(27590): onPageScrolled = 6, 0.76666665, 368
01-03 06:51:00.039: I/System.out(27590): onPageScrolled = 6, 0.76874995, 368
01-03 06:51:00.063: I/System.out(27590): onPageScrolled = 6, 0.7708334, 370
01-03 06:51:00.080: I/System.out(27590): onPageScrolled = 6, 0.7729167, 371
01-03 06:51:00.098: I/System.out(27590): onPageScrolled = 6, 0.775, 372
01-03 06:51:00.115: I/System.out(27590): onPageScrolled = 6, 0.775, 372
01-03 06:51:00.128: I/System.out(27590): onPageScrolled = 6, 0.7770833, 372
01-03 06:51:00.147: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.168: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.183: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.199: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.218: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.237: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.253: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.270: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.290: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.310: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.327: I/System.out(27590): onPageScrolled = 6, 0.76874995, 368
01-03 06:51:00.343: I/System.out(27590): onPageScrolled = 6, 0.76458335, 367
01-03 06:51:00.364: I/System.out(27590): onPageScrolled = 6, 0.7520833, 361
01-03 06:51:00.384: I/System.out(27590): onPageScrolled = 6, 0.7395834, 355
01-03 06:51:00.400: I/System.out(27590): onPageScrolled = 6, 0.7270833, 349
01-03 06:51:00.417: I/System.out(27590): onPageScrolled = 6, 0.7125, 342
01-03 06:51:00.436: I/System.out(27590): onPageScrolled = 6, 0.70000005, 336
01-03 06:51:00.457: I/System.out(27590): onPageScrolled = 6, 0.6833333, 327
01-03 06:51:00.472: I/System.out(27590): onPageScrolled = 6, 0.66875005, 321
01-03 06:51:00.489: I/System.out(27590): onPageScrolled = 6, 0.6520833, 312
01-03 06:51:00.507: I/System.out(27590): onPageScrolled = 6, 0.63750005, 306
01-03 06:51:00.527: I/System.out(27590): onPageScrolled = 6, 0.63125, 303
01-03 06:51:00.543: I/System.out(27590): onPageScrolled = 6, 0.6145834, 295
01-03 06:51:00.560: I/System.out(27590): onPageScrolled = 6, 0.5979167, 287
01-03 06:51:00.579: I/System.out(27590): onPageScrolled = 6, 0.57916665, 278
01-03 06:51:00.599: I/System.out(27590): onPageScrolled = 6, 0.5645833, 271
01-03 06:51:00.616: I/System.out(27590): onPageScrolled = 6, 0.5583333, 267
01-03 06:51:00.632: I/System.out(27590): onPageScrolled = 6, 0.54375005, 261
01-03 06:51:00.652: I/System.out(27590): onPageScrolled = 6, 0.5375, 258
01-03 06:51:00.672: I/System.out(27590): onPageScrolled = 6, 0.5229167, 251
01-03 06:51:00.689: I/System.out(27590): onPageScrolled = 6, 0.51666665, 248
01-03 06:51:00.705: I/System.out(27590): onPageScrolled = 6, 0.5104166, 244
01-03 06:51:00.725: I/System.out(27590): onPageScrolled = 6, 0.5041667, 242
01-03 06:51:00.745: I/System.out(27590): onPageScrolled = 6, 0.48958337, 235
01-03 06:51:00.761: I/System.out(27590): onPageScrolled = 6, 0.47500002, 228
01-03 06:51:00.777: I/System.out(27590): onPageScrolled = 6, 0.46041667, 221
01-03 06:51:00.796: I/System.out(27590): onPageScrolled = 6, 0.45416665, 218
01-03 06:51:00.815: I/System.out(27590): onPageScrolled = 6, 0.4375, 210
01-03 06:51:00.831: I/System.out(27590): onPageScrolled = 6, 0.41875005, 201
01-03 06:51:00.848: I/System.out(27590): onPageScrolled = 6, 0.39583337, 190
01-03 06:50:58.796: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:50:58.812: I/System.out(27590): onPageScrolled = 6, 0.027083278, 12
01-03 06:50:58.829: I/System.out(27590): onPageScrolled = 6, 0.04791665, 22
01-03 06:50:58.849: I/System.out(27590): onPageScrolled = 6, 0.070833325, 33
01-03 06:50:58.869: I/System.out(27590): onPageScrolled = 6, 0.0916667, 44
01-03 06:50:58.885: I/System.out(27590): onPageScrolled = 6, 0.11249995, 53
01-03 06:50:58.902: I/System.out(27590): onPageScrolled = 6, 0.13333333, 63
01-03 06:50:58.921: I/System.out(27590): onPageScrolled = 6, 0.15208328, 72
01-03 06:50:58.942: I/System.out(27590): onPageScrolled = 6, 0.17083335, 82
01-03 06:50:58.958: I/System.out(27590): onPageScrolled = 6, 0.1895833, 90
01-03 06:50:58.975: I/System.out(27590): onPageScrolled = 6, 0.20833337, 100
01-03 06:50:58.994: I/System.out(27590): onPageScrolled = 6, 0.22500002, 108
01-03 06:50:59.015: I/System.out(27590): onPageScrolled = 6, 0.23958337, 115
01-03 06:50:59.030: I/System.out(27590): onPageScrolled = 6, 0.25833333, 124
01-03 06:50:59.047: I/System.out(27590): onPageScrolled = 6, 0.27708328, 132
01-03 06:50:59.065: I/System.out(27590): onPageScrolled = 6, 0.29375005, 141
01-03 06:50:59.085: I/System.out(27590): onPageScrolled = 6, 0.3125, 150
01-03 06:50:59.102: I/System.out(27590): onPageScrolled = 6, 0.33124995, 158
01-03 06:50:59.117: I/System.out(27590): onPageScrolled = 6, 0.34791672, 167
01-03 06:50:59.137: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:50:59.158: I/System.out(27590): onPageScrolled = 6, 0.38125002, 183
01-03 06:50:59.174: I/System.out(27590): onPageScrolled = 6, 0.39791667, 191
01-03 06:50:59.190: I/System.out(27590): onPageScrolled = 6, 0.41458333, 199
01-03 06:50:59.210: I/System.out(27590): onPageScrolled = 6, 0.43124998, 206
01-03 06:50:59.230: I/System.out(27590): onPageScrolled = 6, 0.45000005, 216
01-03 06:50:59.246: I/System.out(27590): onPageScrolled = 6, 0.46875, 225
01-03 06:50:59.263: I/System.out(27590): onPageScrolled = 6, 0.48749995, 233
01-03 06:50:59.283: I/System.out(27590): onPageScrolled = 6, 0.5, 240
01-03 06:50:59.303: I/System.out(27590): onPageScrolled = 6, 0.51666665, 248
01-03 06:50:59.319: I/System.out(27590): onPageScrolled = 6, 0.5333333, 255
01-03 06:50:59.335: I/System.out(27590): onPageScrolled = 6, 0.54791665, 263
01-03 06:50:59.354: I/System.out(27590): onPageScrolled = 6, 0.5625, 270
01-03 06:50:59.373: I/System.out(27590): onPageScrolled = 6, 0.57500005, 276
01-03 06:50:59.389: I/System.out(27590): onPageScrolled = 6, 0.57916665, 278
01-03 06:50:59.406: I/System.out(27590): onPageScrolled = 6, 0.5916667, 284
01-03 06:50:59.426: I/System.out(27590): onPageScrolled = 6, 0.5979167, 287
01-03 06:50:59.446: I/System.out(27590): onPageScrolled = 6, 0.61041665, 293
01-03 06:50:59.462: I/System.out(27590): onPageScrolled = 6, 0.6145834, 295
01-03 06:50:59.479: I/System.out(27590): onPageScrolled = 6, 0.6291667, 302
01-03 06:50:59.499: I/System.out(27590): onPageScrolled = 6, 0.64166665, 308
01-03 06:50:59.519: I/System.out(27590): onPageScrolled = 6, 0.6479167, 311
01-03 06:50:59.535: I/System.out(27590): onPageScrolled = 6, 0.6541667, 314
01-03 06:50:59.552: I/System.out(27590): onPageScrolled = 6, 0.6604167, 317
01-03 06:50:59.572: I/System.out(27590): onPageScrolled = 6, 0.6645833, 319
01-03 06:50:59.592: I/System.out(27590): onPageScrolled = 6, 0.67083335, 322
01-03 06:50:59.608: I/System.out(27590): onPageScrolled = 6, 0.67499995, 323
01-03 06:50:59.624: I/System.out(27590): onPageScrolled = 6, 0.68125, 327
01-03 06:50:59.642: I/System.out(27590): onPageScrolled = 6, 0.6875, 330
01-03 06:50:59.662: I/System.out(27590): onPageScrolled = 6, 0.6916667, 332
01-03 06:50:59.678: I/System.out(27590): onPageScrolled = 6, 0.6979166, 334
01-03 06:50:59.695: I/System.out(27590): onPageScrolled = 6, 0.70208335, 337
01-03 06:50:59.714: I/System.out(27590): onPageScrolled = 6, 0.70624995, 338
01-03 06:50:59.735: I/System.out(27590): onPageScrolled = 6, 0.7125, 342
01-03 06:50:59.750: I/System.out(27590): onPageScrolled = 6, 0.7166667, 344
01-03 06:50:59.767: I/System.out(27590): onPageScrolled = 6, 0.7229167, 347
01-03 06:50:59.787: I/System.out(27590): onPageScrolled = 6, 0.7291666, 349
01-03 06:50:59.807: I/System.out(27590): onPageScrolled = 6, 0.73541665, 353
01-03 06:50:59.823: I/System.out(27590): onPageScrolled = 6, 0.7395834, 355
01-03 06:50:59.840: I/System.out(27590): onPageScrolled = 6, 0.74375, 357
01-03 06:50:59.859: I/System.out(27590): onPageScrolled = 6, 0.7479167, 359
01-03 06:50:59.879: I/System.out(27590): onPageScrolled = 6, 0.7520833, 361
01-03 06:50:59.895: I/System.out(27590): onPageScrolled = 6, 0.7541667, 362
01-03 06:50:59.911: I/System.out(27590): onPageScrolled = 6, 0.7583333, 364
01-03 06:50:59.930: I/System.out(27590): onPageScrolled = 6, 0.7604166, 364
01-03 06:50:59.949: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:50:59.965: I/System.out(27590): onPageScrolled = 6, 0.76250005, 366
01-03 06:50:59.982: I/System.out(27590): onPageScrolled = 6, 0.76458335, 367
01-03 06:51:00.012: I/System.out(27590): onPageScrolled = 6, 0.76666665, 368
01-03 06:51:00.035: I/System.out(27590): onPageScrolled = 6, 0.76666665, 368
01-03 06:51:00.039: I/System.out(27590): onPageScrolled = 6, 0.76874995, 368
01-03 06:51:00.063: I/System.out(27590): onPageScrolled = 6, 0.7708334, 370
01-03 06:51:00.080: I/System.out(27590): onPageScrolled = 6, 0.7729167, 371
01-03 06:51:00.098: I/System.out(27590): onPageScrolled = 6, 0.775, 372
01-03 06:51:00.115: I/System.out(27590): onPageScrolled = 6, 0.775, 372
01-03 06:51:00.128: I/System.out(27590): onPageScrolled = 6, 0.7770833, 372
01-03 06:51:00.147: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.168: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.183: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.199: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.218: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.237: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.253: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.270: I/System.out(27590): onPageScrolled = 6, 0.78125, 375
01-03 06:51:00.290: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.310: I/System.out(27590): onPageScrolled = 6, 0.7791667, 374
01-03 06:51:00.327: I/System.out(27590): onPageScrolled = 6, 0.76874995, 368
01-03 06:51:00.343: I/System.out(27590): onPageScrolled = 6, 0.76458335, 367
01-03 06:51:00.364: I/System.out(27590): onPageScrolled = 6, 0.7520833, 361
01-03 06:51:00.384: I/System.out(27590): onPageScrolled = 6, 0.7395834, 355
01-03 06:51:00.400: I/System.out(27590): onPageScrolled = 6, 0.7270833, 349
01-03 06:51:00.417: I/System.out(27590): onPageScrolled = 6, 0.7125, 342
01-03 06:51:00.436: I/System.out(27590): onPageScrolled = 6, 0.70000005, 336
01-03 06:51:00.457: I/System.out(27590): onPageScrolled = 6, 0.6833333, 327
01-03 06:51:00.472: I/System.out(27590): onPageScrolled = 6, 0.66875005, 321
01-03 06:51:00.489: I/System.out(27590): onPageScrolled = 6, 0.6520833, 312
01-03 06:51:00.507: I/System.out(27590): onPageScrolled = 6, 0.63750005, 306
01-03 06:51:00.527: I/System.out(27590): onPageScrolled = 6, 0.63125, 303
01-03 06:51:00.543: I/System.out(27590): onPageScrolled = 6, 0.6145834, 295
01-03 06:51:00.560: I/System.out(27590): onPageScrolled = 6, 0.5979167, 287
01-03 06:51:00.579: I/System.out(27590): onPageScrolled = 6, 0.57916665, 278
01-03 06:51:00.599: I/System.out(27590): onPageScrolled = 6, 0.5645833, 271
01-03 06:51:00.616: I/System.out(27590): onPageScrolled = 6, 0.5583333, 267
01-03 06:51:00.632: I/System.out(27590): onPageScrolled = 6, 0.54375005, 261
01-03 06:51:00.652: I/System.out(27590): onPageScrolled = 6, 0.5375, 258
01-03 06:51:00.672: I/System.out(27590): onPageScrolled = 6, 0.5229167, 251
01-03 06:51:00.689: I/System.out(27590): onPageScrolled = 6, 0.51666665, 248
01-03 06:51:00.705: I/System.out(27590): onPageScrolled = 6, 0.5104166, 244
01-03 06:51:00.725: I/System.out(27590): onPageScrolled = 6, 0.5041667, 242
01-03 06:51:00.745: I/System.out(27590): onPageScrolled = 6, 0.48958337, 235
01-03 06:51:00.761: I/System.out(27590): onPageScrolled = 6, 0.47500002, 228
01-03 06:51:00.777: I/System.out(27590): onPageScrolled = 6, 0.46041667, 221
01-03 06:51:00.796: I/System.out(27590): onPageScrolled = 6, 0.45416665, 218
01-03 06:51:00.815: I/System.out(27590): onPageScrolled = 6, 0.4375, 210
01-03 06:51:00.831: I/System.out(27590): onPageScrolled = 6, 0.41875005, 201
01-03 06:51:00.848: I/System.out(27590): onPageScrolled = 6, 0.39583337, 190[java] view plaincopyprint?01-03 06:51:00.867: I/System.out(27590): onPageScrollStateChanged = 2
01-03 06:51:00.867: I/System.out(27590): onPageScrollStateChanged = 2[java] view plaincopyprint?01-03 06:51:00.877: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:51:00.880: I/System.out(27590): onPageScrolled = 6, 0.35416663, 169
01-03 06:51:00.887: I/System.out(27590): onPageScrolled = 6, 0.33333337, 160
01-03 06:51:00.913: I/System.out(27590): onPageScrolled = 6, 0.26874995, 128
01-03 06:51:00.913: I/System.out(27590): onPageScrolled = 6, 0.26666665, 127
01-03 06:51:00.930: I/System.out(27590): onPageScrolled = 6, 0.22708333, 109
01-03 06:51:00.948: I/System.out(27590): onPageScrolled = 6, 0.19166672, 92
01-03 06:51:00.966: I/System.out(27590): onPageScrolled = 6, 0.16250002, 78
01-03 06:51:00.966: I/System.out(27590): onPageScrolled = 6, 0.16041672, 77
01-03 06:51:00.983: I/System.out(27590): onPageScrolled = 6, 0.13541663, 64
01-03 06:51:01.001: I/System.out(27590): onPageScrolled = 6, 0.11249995, 53
01-03 06:51:01.019: I/System.out(27590): onPageScrolled = 6, 0.09375, 45
01-03 06:51:01.019: I/System.out(27590): onPageScrolled = 6, 0.0916667, 44
01-03 06:51:01.037: I/System.out(27590): onPageScrolled = 6, 0.07500005, 36
01-03 06:51:01.054: I/System.out(27590): onPageScrolled = 6, 0.0604167, 29
01-03 06:51:01.072: I/System.out(27590): onPageScrolled = 6, 0.04791665, 22
01-03 06:51:01.090: I/System.out(27590): onPageScrolled = 6, 0.039583325, 18
01-03 06:51:01.107: I/System.out(27590): onPageScrolled = 6, 0.03125, 15
01-03 06:51:01.125: I/System.out(27590): onPageScrolled = 6, 0.022916675, 11
01-03 06:51:01.143: I/System.out(27590): onPageScrolled = 6, 0.018749952, 8
01-03 06:51:01.162: I/System.out(27590): onPageScrolled = 6, 0.014583349, 7
01-03 06:51:01.162: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:51:01.178: I/System.out(27590): onPageScrolled = 6, 0.010416627, 4
01-03 06:51:01.196: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:51:01.215: I/System.out(27590): onPageScrolled = 6, 0.006250024, 3
01-03 06:51:01.215: I/System.out(27590): onPageScrolled = 6, 0.0041667223, 2
01-03 06:51:01.249: I/System.out(27590): onPageScrolled = 6, 0.0020833015, 0
01-03 06:51:01.302: I/System.out(27590): onPageScrolled = 6, 0.0, 0
01-03 06:51:00.877: I/System.out(27590): onPageScrolled = 6, 0.36458337, 175
01-03 06:51:00.880: I/System.out(27590): onPageScrolled = 6, 0.35416663, 169
01-03 06:51:00.887: I/System.out(27590): onPageScrolled = 6, 0.33333337, 160
01-03 06:51:00.913: I/System.out(27590): onPageScrolled = 6, 0.26874995, 128
01-03 06:51:00.913: I/System.out(27590): onPageScrolled = 6, 0.26666665, 127
01-03 06:51:00.930: I/System.out(27590): onPageScrolled = 6, 0.22708333, 109
01-03 06:51:00.948: I/System.out(27590): onPageScrolled = 6, 0.19166672, 92
01-03 06:51:00.966: I/System.out(27590): onPageScrolled = 6, 0.16250002, 78
01-03 06:51:00.966: I/System.out(27590): onPageScrolled = 6, 0.16041672, 77
01-03 06:51:00.983: I/System.out(27590): onPageScrolled = 6, 0.13541663, 64
01-03 06:51:01.001: I/System.out(27590): onPageScrolled = 6, 0.11249995, 53
01-03 06:51:01.019: I/System.out(27590): onPageScrolled = 6, 0.09375, 45
01-03 06:51:01.019: I/System.out(27590): onPageScrolled = 6, 0.0916667, 44
01-03 06:51:01.037: I/System.out(27590): onPageScrolled = 6, 0.07500005, 36
01-03 06:51:01.054: I/System.out(27590): onPageScrolled = 6, 0.0604167, 29
01-03 06:51:01.072: I/System.out(27590): onPageScrolled = 6, 0.04791665, 22
01-03 06:51:01.090: I/System.out(27590): onPageScrolled = 6, 0.039583325, 18
01-03 06:51:01.107: I/System.out(27590): onPageScrolled = 6, 0.03125, 15
01-03 06:51:01.125: I/System.out(27590): onPageScrolled = 6, 0.022916675, 11
01-03 06:51:01.143: I/System.out(27590): onPageScrolled = 6, 0.018749952, 8
01-03 06:51:01.162: I/System.out(27590): onPageScrolled = 6, 0.014583349, 7
01-03 06:51:01.162: I/System.out(27590): onPageScrolled = 6, 0.012500048, 6
01-03 06:51:01.178: I/System.out(27590): onPageScrolled = 6, 0.010416627, 4
01-03 06:51:01.196: I/System.out(27590): onPageScrolled = 6, 0.008333325, 3
01-03 06:51:01.215: I/System.out(27590): onPageScrolled = 6, 0.006250024, 3
01-03 06:51:01.215: I/System.out(27590): onPageScrolled = 6, 0.0041667223, 2
01-03 06:51:01.249: I/System.out(27590): onPageScrolled = 6, 0.0020833015, 0
01-03 06:51:01.302: I/System.out(27590): onPageScrolled = 6, 0.0, 0[java] view plaincopyprint?01-03 06:51:01.514: I/System.out(27590): onPageScrollStateChanged = 0
01-03 06:51:01.514: I/System.out(27590): onPageScrollStateChanged = 0
其实到这里,大概的含义就清楚了。
onPageScrollStateChanged 为1的时候表示开始滑动,为2的时候表示手指松开了页面自动滑动,为0的时候表示停止在某页
而且只要有onPageScrollStateChanged == 2 才有可能触发onPageSelected,向右滑动为当前页面+1,向左滑动为当前页面-1
但是这个好记,就是当前页跳转后的页面,如果和当前页一样,就不会调用。
onPageScrolled向右滑动,第一个参数表示的是当前的页面,向左滑动表示的是上一个页面的标号,后面2个参数看了日志其实很好理解。
好了,终于把这个地方做了一个详细的总结。