【发布时间】:2011-06-29 18:13:18
【问题描述】:
我在viewFlipper 中的litView 遇到了一些问题。
// GestureDetector
class MyGestureDetector extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
try {
if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
return false;
// Right to left swipe
if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
IconManager.INSTANCE.leftSwipe();
vf.setInAnimation(slideLeftIn);
vf.setOutAnimation(slideLeftOut);
vf.showNext();
System.out.println("SWIIINGG!!");
// Left to right swipe
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
IconManager.INSTANCE.rightSwipe();
vf.setInAnimation(slideRightIn);
vf.setOutAnimation(slideRightOut);
vf.showPrevious();
}
} catch (Exception e) {
// nothing
}
return false;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Log.e("Item Click","Item Click");
Intent intentAgenda = new Intent (Activity_Main.this, AgendaSelected.class);
//intentAgenda.putExtra("LECTURE_NAME", homeAgendaListAdapter.getItemId(3));
startActivity(intentAgenda);
return super.onSingleTapConfirmed(e);
}
}
此代码使我能够在翻转器中的视图之间翻转并在不同翻转内的列表中滚动。但是,这使我的整个应用可点击。即使我在空白表面上singleTap,它也会记录一次点击,并将我发送到Intent intentAgenda = new Intent 想要发送给我的位置。只有当我点击 listView 中的项目时才会发生这种情况!
我该怎么做才能让特定列表上的听众只听“在列表上”而不是整个应用程序?我相信问题出在public boolean onSingleTapConfirmed,但我看不到。
【问题讨论】:
标签: android listview android-intent scroll viewflipper