码迷,mamicode.com
首页 > 移动开发 > 详细

android 简单的欢迎动画

时间:2015-04-10 17:07:15      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

 1 package com.leolu.fristapp;
 2 
 3 import android.app.Activity;
 4 import android.os.Bundle;
 5 import android.view.View;
 6 import android.view.animation.AlphaAnimation;
 7 import android.view.animation.Animation;
 8 import android.view.animation.Animation.AnimationListener;
 9 
10 public class SplashPage extends Activity {
11 
12     @Override
13     protected void onCreate(Bundle savedInstanceState) {
14         super.onCreate(savedInstanceState);
15         
16         //获取activity_splash_page.xml布局
17         View view =  View.inflate(this, R.layout.activity_splash_page, null);
18         //加载布局
19         setContentView(view);
20         
21         //设置动画,渐显渐隐可用AlphaAnimation,变形动画用RotateAnimation,位移动画用TranslateAnimation
22         //第一个参数值0.3f为开始的透明度为30%,第二个参数值1.0f为结束的透明度为100%,即不透明。
23         AlphaAnimation alphaAnimation = new AlphaAnimation(0.3f, 1.0f);
24         
25         //给动画设置持续时间,如果不设置,则时间为0,动画就看不到效果
26         alphaAnimation.setDuration(2000);
27         
28         //给我们的背景运行动画
29         view.startAnimation(alphaAnimation);
30         
31         //设置动画监听
32         alphaAnimation.setAnimationListener(new AnimationListener() {
33             
34             @Override  //动画一开始就执行以下方法
35             public void onAnimationStart(Animation animation) {
36                 
37             }
38             
39             @Override //动画重复时执行以下方法
40             public void onAnimationRepeat(Animation animation) {
41                 
42             }
43             
44             @Override //动画结束时执行以下方法
45             public void onAnimationEnd(Animation animation) {
46                 
47             }
48         });
49         
50     }
51 
52     
53 }

 

android 简单的欢迎动画

标签:

原文地址:http://www.cnblogs.com/jiji/p/4414779.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!