部分代码如下 if (canDragOver()) {//判断是否可以翻页
startAnimation(1200);
} else {
mTouch.x = mCornerX - 0.09f;//如果不能翻页就让mTouch返回没有静止时的状态
mTouch.y = mCornerY - 0.09f; // - 0.09f是防止mTouch = 800 或mTouch= 0 要不在这些值时会出现BUG
}
this.repaint();
/******************/
public void computeScroll() {
super.computeScroll();
if (mScroller.computeScrollOffset()) {
float x = mScroller.getCurrX();
float y = mScroller.getCurrY();
mTouch.x = x;
mTouch.y = y;
repaint();
}}
private void startAnimation(int delayMillis) {
int dx, dy;
// dx 水平方向滑动的距离,负值会使滚动向左滚动
// dy 垂直方向滑动的距离,负值会使滚动向上滚动
if (mCornerX > 0) {
dx = -(int) (Constant.SCREEN_WIDTH + mTouch.x);
} else {
dx = (int) (Constant.SCREEN_WIDTH - mTouch.x + Constant.SCREEN_WIDTH);
}
if (mCornerY > 0) {
dy = (int) (Constant.SCREEN_HEIGHT - mTouch.y);
} else {
dy = (int) (1 - mTouch.y); // 防止mTouch.y最终变为0
}
mScroller.startScroll((int) mTouch.x, (int) mTouch.y, dx, dy,
delayMillis);
}
不知道是那里出错了,没有反应求解
startAnimation(1200);
} else {
mTouch.x = mCornerX - 0.09f;//如果不能翻页就让mTouch返回没有静止时的状态
mTouch.y = mCornerY - 0.09f; // - 0.09f是防止mTouch = 800 或mTouch= 0 要不在这些值时会出现BUG
}
this.repaint();
/******************/
public void computeScroll() {
super.computeScroll();
if (mScroller.computeScrollOffset()) {
float x = mScroller.getCurrX();
float y = mScroller.getCurrY();
mTouch.x = x;
mTouch.y = y;
repaint();
}}
private void startAnimation(int delayMillis) {
int dx, dy;
// dx 水平方向滑动的距离,负值会使滚动向左滚动
// dy 垂直方向滑动的距离,负值会使滚动向上滚动
if (mCornerX > 0) {
dx = -(int) (Constant.SCREEN_WIDTH + mTouch.x);
} else {
dx = (int) (Constant.SCREEN_WIDTH - mTouch.x + Constant.SCREEN_WIDTH);
}
if (mCornerY > 0) {
dy = (int) (Constant.SCREEN_HEIGHT - mTouch.y);
} else {
dy = (int) (1 - mTouch.y); // 防止mTouch.y最终变为0
}
mScroller.startScroll((int) mTouch.x, (int) mTouch.y, dx, dy,
delayMillis);
}
不知道是那里出错了,没有反应求解
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货