A basic animation not showing up

Posted by Rilakkuma on Stack Overflow See other posts from Stack Overflow or by Rilakkuma
Published on 2010-04-02T14:24:07Z Indexed on 2010/04/02 14:43 UTC
Read the original article Hit count: 194

Filed under:

I still try different basics with android, and now I'm stuck with animation. I'm trying to implement a simple animation. I've defined animation in xml file like this:

alpha android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="0.0" android:toAlpha="1.0" duration="3000" repeatCount="infinite"

In my main view group I have an ImageView defined like this:

<ImageView android:id="@+id/someb" android:src="@drawable/earth_normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dip"/>

And this is from my starting activity class:

public class Ohayou extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    ImageView earth = (ImageView)findViewById(R.id.someb);
    Animation earthFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in);
    earth.startAnimation(earthFadeInAnimation);
}

It finds ImageView successfuly and creates animation. but when I start emulator ImageView just shows the original src image, not an animation. What am I doing wrong?

Thanks

© Stack Overflow or respective owner

Related posts about android