2012-05-15 95 views
2

我試圖在imageview中從上到下移動一個圖像,然後返回..但圖像似乎停留在這個地方,根本不能移動。我試圖動畫類型,但它沒有work..here是代碼..如何在android中移動和動畫圖像?

setContentView(R.layout.game); 
    AnimationSet set=new AnimationSet(true); 
    Animation animation=new TranslateAnimation(0,2000,0,1220); 
    ImageView img =new ImageView(this); 
    img.setImageResource(R.drawable.dig); 
    animation.setDuration(3000); 
    animation.setFillAfter(true); 
    set.addAnimation(animation); 
    set.startNow(); 

回答