Luke Batley
Luke Batley

Reputation: 2402

Android Animate an Image View vertically

Hi i have an image view position and the bottom of the page i'm wanting to animate so it moves down does anyone know how to do this? currently when i run it nothing happens

here is what i have tried so far

heres my animation

<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/accelerate_interpolator">
   <translate android:fromYDelta="0" android:toXDelta="30" android:duration="1000"
       android:fillAfter="true"/>

</set>

heres my java

public class IntialSetup extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_initialsetup);
        animations();

    }


    public void animations(){

    final ImageView image = (ImageView)findViewById(R.id.su_shirts);
    Animation AnimationMovepos = AnimationUtils.loadAnimation(this, R.anim.shirt_anim); 
    image.startAnimation(AnimationMovepos); 

    }



}

Upvotes: 1

Views: 1926

Answers (1)

AMerle
AMerle

Reputation: 4354

Look at your animation:

<translate android:fromYDelta="0" android:toXDelta="30" .../>

fromYDelta ... toYDelta and not toXDelta.

Hope this was the problem.

Upvotes: 2

Related Questions