<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.test.SplashActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/splash_iv"
android:scaleType="fitXY"
android:src="@mipmap/splash"/>
</RelativeLayout>
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(SplashActivity.this,MainActivity.class);
startActivity(intent);
SplashActivity.this.finish();
}
},3000);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
iv =(ImageView)findViewById(R.id.splash_iv);
iv.setImageResource(R.mipmap.splash);
//设置透明度动画从无到有
AlphaAnimation alphaAnimation=new AlphaAnimation(0.0f,1.0f);
//设置动画持续时间
alphaAnimation.setDuration(3000);
//开始显示动画
iv.startAnimation(alphaAnimation);
//给动画设置监听,在动画结束的时候进行跳转
alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
//动画开始时执行
Log.e("TAG", "onAnimationStart: " );
}
@Override
public void onAnimationEnd(Animation animation) {
//动画结束时执行
Log.e("TAG", "onAnimationEnd: " );
Intent intent=new Intent(SplashActivity.this,MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
//动画重复播放时执行
Log.e("TAG", "onAnimationRepeat: " );
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
iv =(ImageView)findViewById(R.id.splash_iv);
iv.setImageResource(R.mipmap.splash);
Timer timer=new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Intent intent=new Intent(SplashActivity.this,MainActivity.class);
startActivity(intent);
finish();
}
},3000);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有