2
我使用视图鳍状肢翻转20个图像和翻转上滑动和我的活动的底部我有两个按钮用于手动切换左图像或right.These两个是工作,但我不能够表现出相同的图像:Android:同步图像上的一跳和onclick也显示上一个和下一个视图相同的图像
为如: 如果我从图像2滑动到图像3和明年我在阵列单击显示下一步按钮,然后其切换至第一影像但我想去第三张图片4.我知道它展示了他们想要做的特征,但没有任何逻辑来解决这个问题。任何帮助都会非常可观。
onfling方法:
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX,float velocityY){
if(isDragMode)
return false;
final float ev1x = event1.getX();
final float ev1y = event1.getY();
final float ev2x = event2.getX();
final float ev2y = event2.getY();
final float xdiff = Math.abs(ev1x - ev2x);
final float ydiff = Math.abs(ev1y - ev2y);
final float xvelocity = Math.abs(velocityX);
final float yvelocity = Math.abs(velocityY);
if(xvelocity > this.SWIPE_MIN_VELOCITY && xdiff > this.SWIPE_MIN_DISTANCE){
//vf1.removeAllViewsInLayout();
vf1.removeViewInLayout(im);
i1.setVisibility(View.VISIBLE);
if(ev1x > ev2x) //Swipe Right {
++currentview;
if(currentview >= a.length){
currentview = a.length - 1;
}
vf.setInAnimation(animleftin);
vf.setOutAnimation(animleftout);
}else{
--currentview;
if(currentview < 0){
currentview = 0;
}
vf.setInAnimation(animrightin);
vf.setOutAnimation(animrightout);
}
vf.scrollTo(0,0);
vf.setDisplayedChild(currentview);
}
return false;
}
onclick事件:
ImageView rit=(ImageView)findViewById(R.id.imageView6);
rit.setOnClickListener(new OnClickListener(){
public void onClick(View arg0) {
// TODO Auto-generated method stub
vf.showNext();
}
});