2013-06-20 147 views
1

我正在使用以下從左向右滑動並在圖像視圖上設置動畫的代碼。 但是,當從左向右滑動圖像時,當前圖像消失,下一張圖像將伴隨動畫刷卡。但是我想刷一下當前的圖像,它會去掉動畫。請幫助我,感激你!如何在將圖像從右向左移動時對imageview設置動畫

我的代碼是:

{ 
    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); 
} 

回答

相關問題