문제

I'm trying to make an image view to grow and reduce only on the x axis, yes, I want to deformate it. It is actually the shadow of a bouncing ball. I'm trying to achive it with the scale animation, but it translate. Anyone that can help? Here's the code of the animation that I'm using.

shadow.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" >
<scale
    android:duration="10000"
    android:fromXScale="1.1"
    android:fromYScale="1.0"    
    android:toXScale="0.1"
    android:toYScale="1.0" />

<alpha
    android:duration="10000"
    android:fromAlpha="1.0"
    android:toAlpha="0.0" />

</set>
도움이 되었습니까?

해결책

I tested your code out and here is what i found:

The code that you have provided initially scales the object in X axis to 1.1 directly(i.e without any animation).

Next, the object is scaled down in X axis to 0.1 while the alpha goes down. The scaling takes place about the upper left corner of the object(i.e the pivot is set to default).

If you want the scaling to happen about any other point,you can specify that as

     android:pivotX="x%"
     android:pivotY="y%"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top