如何使actcity在android中消失?我使用了以下代码,但没有任何反应
public class MetroActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.metro_splash);
getWindow().setWindowAnimations(R.anim.intro_anim);
Runnable r= new Runnable() {
@Override
public void run() {
Intent i = new Intent(getApplicationContext(),MainActivity.class);
startActivity(i);
}
};
Handler h = new Handler();
h.postDelayed(r, 3000);
}
}
动画xml:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="1.0" />