首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

listview中viewflipper的有关问题

2012-09-10 
listview中viewflipper的问题在listview中使用viewflipper,?class MyGestureDetector extends SimpleOnGes

listview中viewflipper的问题

在listview中使用viewflipper,

?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 true;?
? ? ? ? ? ? // right to left swipe?
? ? ? ? ? ? if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {?
?
?
? ? ? ? ? ? } ?else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {?
? ? ? ? ? ? ? ? viewFlipper.setInAnimation(slideRightIn);?
? ? ? ? ? ? ? ? viewFlipper.setOutAnimation(slideRightOut);?
? ? ? ? ? ? ? ? viewFlipper.showPrevious();?
? ? ? ? ? ? }?
? ? ? ? } catch (Exception e) {?
? ? ? ? ? ? // nothing?
? ? ? ? }?
? ? ? ? return true;?
? ? }?
}?
lstView.setOnTouchListener(gestureListener);?

然后呢就会和setOnItemClickListener这个冲突,你本来想进行viewFlipper转换的时候却触发了OnItemClickListener,为了解决这个问题

需要继承 @Override?
? ? public boolean onSingleTapConfirmed(MotionEvent e) {?
? ? ? ? // TODO Auto-generated method stub?
? ? ? ? ? ? Log.e("Item Click","Item Click");?
? ? ? ? return super.onSingleTapConfirmed(e);?
? ? }?
在SimpleOnGestureListener中

热点排行