智慧北京项目总结(一)
来源:互联网 发布:淘宝设置粉丝圈 编辑:程序博客网 时间:2024/04/29 18:21
一、闪屏页(SplashActivity)开发
主要功能是:用户看见的第一个界面;有集合动画的效果;当闪屏页结束后,按照isFirstEnter标识来标记用户是否是第一次使用该应用,若是第一次则进入GuideActivity,否则进入MainActivity。代码如下:
package com.yxy.zhbj;import com.yxy.zhbj.utils.PrefUtils;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.animation.AlphaAnimation;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener;import android.view.animation.AnimationSet;import android.view.animation.RotateAnimation;import android.view.animation.ScaleAnimation;import android.widget.RelativeLayout;public class SplashActivity extends Activity {//SplashActivity的根布局RelativeLayout rlRoot;@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); rlRoot = (RelativeLayout) findViewById(R.id.rl_root); //旋转动画 RotateAnimation animRotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animRotate.setDuration(1000);//设置动画持续时间 animRotate.setFillAfter(true);//保持动画结束状态 //缩放动画 ScaleAnimation animScale = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animScale.setDuration(1000); animScale.setFillAfter(true);//保持动画结束状态 //渐变动画 AlphaAnimation animAlpha = new AlphaAnimation(0, 1); animAlpha.setDuration(2000); animAlpha.setFillAfter(true);//保持动画结束状态 //集合动画 AnimationSet set = new AnimationSet(true); set.addAnimation(animRotate); set.addAnimation(animScale); set.addAnimation(animAlpha); //启动动画 rlRoot.startAnimation(set); //给集合动画设置监听事件 set.setAnimationListener(new AnimationListener() {@Overridepublic void onAnimationStart(Animation animation) {}@Overridepublic void onAnimationRepeat(Animation animation) {}//动画完成后调用@Overridepublic void onAnimationEnd(Animation animation) {//设置标记boolean isFirstEnter = PrefUtils.getBoolean(SplashActivity.this, "isFirstEnter", true);Intent intent;//判断用户是否第一次进入if (isFirstEnter) {//进入新手引导页intent = new Intent(getApplicationContext(),GuideActivity.class);} else {//进入主页面intent = new Intent(getApplicationContext(),MainActivity.class);}startActivity(intent);//销毁当前页面finish();}}); }}给集合动画设置监听事件,当动画结束后,根据标识进入相应页面同时销毁闪屏页面。
0 0
- 智慧北京项目总结(一)
- 智慧北京项目总结
- 智慧北京项目总结
- Android智慧北京项目总结
- Android 项目实战:智慧北京(黑马)
- Android 项目实战:智慧北京(黑马)
- 项目1------智慧北京
- 智慧北京总结
- 智慧北京项目第一天
- Android之智慧北京一
- 智慧北京(2017.09.01)
- 智慧北京(2017.09.01)
- 智慧北京
- 北京项目总结
- 面试总结(一)北京亿信华辰
- 智慧XX项目的总结
- 智慧北京开发第一天(上)
- 智慧北京开发第一天(下)
- Python 网络爬虫 001 (科普) 网络爬虫简介
- POJ 3480 John (Nim博弈)
- set容器的用法
- 既然睡不着
- poj 1692
- 智慧北京项目总结(一)
- 2016/9/2
- start...
- Lua学习笔记(一)
- 数据挖掘方法
- 安卓智慧上海学习笔记系列——给文字图片加状态选择器不起作用解决办法
- 1052 卖个萌
- 导出
- 计算面积 ssl 1715 计算几何