public class MyGallery extends Gallery {
public MyGallery(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
/**
* ①点下去的事件
* ②当前的事件
* ③滑动的x方向速度
* ④y方向的速度
*/
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
Log.v("velocityX========="+velocityX, "velocityY ===="+velocityY);
velocityX = velocityX>0 ? 400 : -400;
return super.onFling(e1, e2, velocityX, velocityY);
}
}
public MyGallery(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public MyGallery(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
/**
* ①点下去的事件
* ②当前的事件
* ③滑动的x方向速度
* ④y方向的速度
*/
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
Log.v("velocityX========="+velocityX, "velocityY ===="+velocityY);
velocityX = velocityX>0 ? 400 : -400;
return super.onFling(e1, e2, velocityX, velocityY);
}
}