手势翻页onfling

hai675264783 2011-02-17 04:33:35
我想让它翻页时Y方向的角度小点
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
if (e1.getX() - e2.getX() > 120 && velocityY/velocityX < 1/2 && velocityY/velocityX > -1/2){//如果是从右向左滑动
this.viewflipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.left_in));
this.viewflipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.left_out));
// page ++;
但翻不了啊,郁闷。
...全文
144 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chatcoco 2011-02-18
  • 打赏
  • 举报
回复
	private boolean rather(float x,float y){
if(x>y){
if(x-y>40){
return true;
}
}else if(x<y){
if(y-x>40){
return true;
}
}
return false;
}
hai675264783 2011-02-17
  • 打赏
  • 举报
回复
要这么麻烦吗?
dinjay 2011-02-17
  • 打赏
  • 举报
回复
那就横竖屏判断一下,分别处理呗
hai675264783 2011-02-17
  • 打赏
  • 举报
回复
Math.abs(e1.getY()-e2.getY()) < 40,这样,当横着的时候也不行啊

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧