Animation.setFillAfter and Animation.setFillBefore的作用


轉:http://blog.csdn.net/yangweigbh/article/details/9788531

setFillAfter(boolean fillAfter)  在Android developer上的文檔:

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

但是,animation只是操作View 的位圖表示(bitmap representation),而不是真正的改變View的位置

動畫結束后,View回到了原來的位置,setFillAfter 和 setFillBefore 並不能解決這個問題,要使View保持動畫結束時的狀態,必須另外改變View的屬性(動畫並不會幫助你改變View的屬性),setFillAfter 和 setFillBefore 只能改變動畫的屬性

為什么會有setFillAfter 和 setFillBefore這兩個方法:

是因為有動畫鏈的原因,假定你有一個移動的動畫緊跟一個淡出的動畫,如果你不把移動的動畫的setFillAfter置為true,那么移動動畫結束后,View會回到原來的位置淡出,如果setFillAfter置為true, 就會在移動動畫結束的位置淡出


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM