2011-06-29 38 views
1

我見過各種各樣的代碼,這讓我覺得我的應該可以工作,但由於某種原因它沒有。我有一個ImageView,可以垂直向下調整另一個圖像,並且我希望移動圖像視圖在動畫完成後消失,但不會。 '掃描條'imageview是有問題的。它在XML中設置爲不可見,並在按鈕按下時可見。動畫完成後,我需要它消失。ImageView相對佈局中的可見性問題

public class scan extends Activity { 

EditText Quote; 
private static final Random rgenerator = new Random(); 
ImageView scanbar; 
public void scanLine() { 
    // Displays the scanline animation over the wireframe image 


    ImageView wireframe; 
    scanbar = (ImageView)findViewById(R.id.scanbar); 
    wireframe = (ImageView) findViewById(R.id.wireframe); 
    scanbar.setVisibility(View.VISIBLE); 
    // Super ultra-secret code 

} 
Animation.AnimationListener scanListener = new Animation.AnimationListener() { 

    @Override 
    public void onAnimationStart(Animation animation) { 
     // TODO Auto-generated method stub 

    } 

    @Override 
    public void onAnimationRepeat(Animation animation) { 
     // TODO Auto-generated method stub 

    } 

    @Override 
    public void onAnimationEnd(Animation animation) { 
     // TODO Auto-generated method stub 
     scanbar.setVisibility(View.INVISIBLE); 
     setResults(); 
    } 
}; 

setResults();調用工作正常,所以我知道這段代碼正在執行。任何人都知道我在做什麼錯了?

+0

你在用什麼動畫幀? – user710502

+0

這是一個將圖像從框架頂部移動到底部的翻譯動畫 – Carnivoris

回答

0

我可以證實,前呼籲什麼都查看正在做動畫clearAnimation():在正在調用View.INVISIBLE之前做動畫的視圖中調用clearAnimation(),或GONE的伎倆。