2010-08-27 80 views
2

如何在動畫後獲取View的Alpha /不透明度?在Android中獲取視圖的alpha /不透明度

我的fadeIn()低於 -​​與端點切換相同。

public void fadeIn(View view) { 
    Animation animation = new AlphaAnimation(0.0f, 1.0f); 
    animation.setDuration(1000); 
    animation.setFillAfter(true); 
    view.startAnimation(animation); 
} 

回答

1

我強烈建議您在XML文件中定義動畫。 API不支持獲取特定的字母。

您仍然可以記住您的視圖所具有的不透明度是您定義的最後一個;在這種情況下(您的fadeIn()方法),您最新的不透明度值是您傳遞給AlphaAnimation構造函數的值。