Fade in function not working in Eclipse

2019-09-07 13:44发布

问题:

I have set up the fade in functionality properly but its not working

MainActivity.java

setContentView(R.layout.activity_main);
    ImageView iv = (ImageView) findViewById(R.id.sname);
    final Animation animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.fadein);
    iv.startAnimation(animationFadeIn);
    Thread timer = new Thread(){
        public void run(){
            try{
                sleep(4000);

            }catch(InterruptedException e)
            {
                e.printStackTrace();
            }finally{
                Intent in = new Intent(getApplicationContext(),HomescreenJ.class);
                startActivity(in);


            }

        }

    };
    timer.start();

fadein.xml

 <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
  android:interpolator="@android:anim/linear_interpolator">
  <alpha
      android:fromAlpha="0.1"
      android:toAlpha="1.0"
      android:duration="2000"
      />
</set>

Kindly its basically my splash screen. On which i want one image to be stationary and other one to be displayed with Fade-in effect.