如题,onFling方法已经重写@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
int kEvent;
if (isScrollingLeft(e1, e2)) {
// Check if scrolling left
kEvent = KeyEvent.KEYCODE_DPAD_LEFT;
} else {
// Otherwise scrolling right
kEvent = KeyEvent.KEYCODE_DPAD_RIGHT;
}
onKeyDown(kEvent, null);
return false;
// return super.onFling(e1, e2, velocityX, velocityY);
// return false;
}问题在,正常情况下不会触发回弹,但是因为下方还有几个圆点来显示当前显示的是第几张图片,所以为gallery实现了onItemSelectedListener接口,在接口中进行UI操作控制下面的圆点图片切换,就会导致gallery图片滑动产生回弹。
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
pointViews[pointId].setBackgroundResource(R.drawable.goods_detail_dot_unselected);
pointViews[position].setBackgroundResource(R.drawable.goods_detail_dot_selected);
pointId = position;
}或者哪位大神能够指点一下viewpager如何避免在viewpager内手指滑动的时候不触发父控件的onTouch,本来可以用viewpager实现,,但是有问题所以选择了gallery。。结果gallery又有各种各样的问题。。囧 求解答 在线等
androidgallery
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
int kEvent;
if (isScrollingLeft(e1, e2)) {
// Check if scrolling left
kEvent = KeyEvent.KEYCODE_DPAD_LEFT;
} else {
// Otherwise scrolling right
kEvent = KeyEvent.KEYCODE_DPAD_RIGHT;
}
onKeyDown(kEvent, null);
return false;
// return super.onFling(e1, e2, velocityX, velocityY);
// return false;
}问题在,正常情况下不会触发回弹,但是因为下方还有几个圆点来显示当前显示的是第几张图片,所以为gallery实现了onItemSelectedListener接口,在接口中进行UI操作控制下面的圆点图片切换,就会导致gallery图片滑动产生回弹。
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
pointViews[pointId].setBackgroundResource(R.drawable.goods_detail_dot_unselected);
pointViews[position].setBackgroundResource(R.drawable.goods_detail_dot_selected);
pointId = position;
}或者哪位大神能够指点一下viewpager如何避免在viewpager内手指滑动的时候不触发父控件的onTouch,本来可以用viewpager实现,,但是有问题所以选择了gallery。。结果gallery又有各种各样的问题。。囧 求解答 在线等
androidgallery
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货