您的位置:首页 > 移动开发 > Android开发

android 如何控制Gallery 滑动速度

2013-06-08 15:43 399 查看
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);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: