2013-02-06 1 views
2

Android 앱에서 눈금 애니메이션입니다.Android : 방향이 변경되면 눈금 애니메이션이 작동하지 않습니다.

<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator" android:fillEnabled="true" android:fillAfter="true" > 
<scale android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="1.0"  android:duration="32000" /> 
</set> 

잘 작동합니다. 보기를 왼쪽에서 오른쪽으로 조정합니다. 하지만 오른쪽에서 왼쪽으로 확장해야합니다. 그래서 fromXScale="-1.0"을 수정하면 애니메이션이 발생하지 않고 애니메이션없이보기가 즉시 조정됩니다.

<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator" android:fillEnabled="true" android:fillAfter="true" >    
    <scale android:fromXScale="-1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="1.0"  android:duration="32000" /> 
</set> 

가 어떻게 반대 방향에서보기 애니메이션을 적용 할 수 있습니다 : 반대 방향에 대한 나의 애니메이션 XML은 아래와 같습니다? 내 코드에 어떤 문제가 있습니까?

답변

1

피벗을 사용하면 문제가 해결됩니다. pivotX와 pivotY를 통해 애니메이션의 방향을 제어하는 ​​것이 더 좋습니다.

1

애니메이션에도 android:fillBefore="true"을 추가해야합니다.

앞으로 애니메이션의보기에는 일반적으로 1의 눈금이 있으므로 시작시 설정할 필요가 없습니다. 하지만 반전 애니메이션에서는 기본적으로 (예 : 1) 시작하고 애니메이션을 적용합니다. 1

관련 문제