应用程序的闪屏效果的制作

每个应用程序都会有闪屏页面的,那么接下来就看看闪屏页面是如何实现的?

效果图:


demo框架如下:


1、闪屏的布局如下:其实就是一张背景图

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_app"
    android:orientation="vertical" >
</LinearLayout>

2、WelcomeActivity.java的代码如下:

package com.example.bamboo_splash;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;

public class WelcomeActivity extends Activity {

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		/** 方式一*/
//		AlphaAnimation animation=new AlphaAnimation(0.3f, 1f);
//		animation.setDuration(3000);
//		animation.setAnimationListener(new AnimationListener() {
//			
//			@Override
//			public void onAnimationStart(Animation animation) {
//				
//			}
//			
//			@Override
//			public void onAnimationRepeat(Animation animation) {
//				
//			}
//			/** 动画结束执行的方法*/
//			@Override
//			public void onAnimationEnd(Animation animation) {
//				redirectTo();
//			}
//		});
		
		/** 方式二*/
		new Handler().postDelayed(new Runnable() {
			
			@Override
			public void run() {
				redirectTo();
			}
		}, 3000);
	}
	/**
	 * 即将跳转的页面
	 */
	public void redirectTo(){
		Intent intent=new Intent(WelcomeActivity.this, MainActivity.class);
		startActivity(intent);
		finish();
	}
}


这样一个简单的闪屏效果就实现了呢,而且闪屏效果的实现有很多都方式,思路就是让你开始的节面等待个几秒钟,然后显示


代码就不上传了很简单




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值