【发布时间】:2010-07-19 15:34:07
【问题描述】:
我正在编写一个 android 应用程序,我的“测试”设备是 Motorola Milestone (Droid)。我做了一个像 iPhone 主菜单一样滚动的网格(带有“点”)。 我遇到了两个问题:
- 第一个:拖动仅适用于 Android 设备模拟器,不适用于 Droid! (也许多点触控屏幕有问题?)
- 拖拽太负责了,有时会一个一个(这没问题)翻转视图,有时是 2 x 2 或 3 x 3!这显然是有问题的!
这是我的 OnTouch 方法的代码:
public boolean onTouch(View v, MotionEvent event) {
if (v instanceof GridView){
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_MOVE:
if (event.getEdgeFlags()==MotionEvent.EDGE_LEFT){
vf2.setInAnimation(this, R.anim.slide_left);
vf2.setOutAnimation(this, R.anim.slide_right);
vf2.showNext();
if (numCurrentPage==2){
numCurrentPage= 0;
} else {
numCurrentPage++;
}
notifyPageNumber(numCurrentPage);
}
if (event.getEdgeFlags()==MotionEvent.EDGE_RIGHT){
vf2.setInAnimation(this, R.anim.slide_in);
vf2.setOutAnimation(this, R.anim.slide_out);
vf2.showPrevious();
if (numCurrentPage==0){
numCurrentPage= 2;
} else {
numCurrentPage--;
}
notifyPageNumber(numCurrentPage);
}
break;
default:
break;
}
}
return false;
}
感谢您的帮助!
更新:它不再在 Google Nexus One 上运行!
【问题讨论】: