我正在使用以下代码从左向右滑动并在图像视图上设置动画。但是,当从左向右滑动图像时,当前图像会消失,下一张图像将带有动画滑动。但我想在当前图像上滑动它会像滑动动画一样。请帮助我并感谢你!
我的代码是:
{
Log.v(TAG + "onClick", "left to right swipe ");
currentindex++;
Log.v(TAG + "onClick", "you select image num : " +currentindex);
//gallery.setSelection(currentindex, true);
filename = it.get(currentindex);
image = getBitmapFromAsset(filename);
Drawable drawable = new BitmapDrawable(image);
//imageView.setAnimation(slideLeftIn);
TranslateAnimation anim = new TranslateAnimation(1000, 0, 0, 0);
anim.setDuration(500);
anim.setFillAfter(true);
imageView.startAnimation(anim);
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ScaleType.FIT_CENTER);
//imageswitcher.setOutAnimation(slideRightOut);
int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_medium);
imageView.setPadding(padding, padding, padding, padding);
imageView.setImageDrawable(drawable);
}